1.2.0-rc1 #1
@@ -717,17 +717,12 @@ Function Get-GiteaChildItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$itemObj = [PSCustomObject]@{
|
$itemObj = [PSCustomObject]@{
|
||||||
filePath = $item.path
|
|
||||||
Path = $item.path
|
|
||||||
repoOwner = $repoOwner
|
|
||||||
repoName = $repoName
|
|
||||||
giteaURL = $giteaURL
|
|
||||||
downloadURL = $item.download_url
|
|
||||||
branch = $branch
|
|
||||||
type = $item.type
|
|
||||||
name = $item.name
|
name = $item.name
|
||||||
|
Path = $item.path
|
||||||
|
type = $item.type
|
||||||
size = $item.size
|
size = $item.size
|
||||||
sha = $item.sha
|
sha = $item.sha
|
||||||
|
downloadURL = $item.download_url
|
||||||
Success = $true
|
Success = $true
|
||||||
Error = $null
|
Error = $null
|
||||||
Level = 0
|
Level = 0
|
||||||
@@ -786,21 +781,31 @@ Function Get-GiteaChildItem {
|
|||||||
}
|
}
|
||||||
if ($isLFS) {
|
if ($isLFS) {
|
||||||
$subItem.type = "lfs"
|
$subItem.type = "lfs"
|
||||||
|
# Save the original download URL for LFS pointers to be used to populate the size and sha fields
|
||||||
|
$GitLFSPointerURL = $subItem.download_url
|
||||||
|
# Use the Gitea API to get the LFS pointer details
|
||||||
|
# For LFS files, we need to get the pointer file and parse it for details
|
||||||
|
$lfsPointerContent = Invoke-RestMethod -Uri $GitLFSPointerURL -Method Get -Headers $headers -ErrorAction Stop
|
||||||
|
Write-Debug "LFS Pointer Content: $($lfsPointerContent)"
|
||||||
|
|
||||||
|
# Parse the LFS pointer to extract size and SHA
|
||||||
|
if ($lfsPointerContent -match 'oid sha256:([a-f0-9]+)') {
|
||||||
|
$subItem.sha = $matches[1]
|
||||||
|
}
|
||||||
|
if ($lfsPointerContent -match 'size (\d+)') {
|
||||||
|
$subItem.size = [long]$matches[1]
|
||||||
|
}
|
||||||
|
# Set the download URL to the media endpoint for LFS files to download the actual file
|
||||||
$subItem.download_url = "$giteaURL/api/v1/repos/$repoOwner/$repoName/media/$($subItem.path)"
|
$subItem.download_url = "$giteaURL/api/v1/repos/$repoOwner/$repoName/media/$($subItem.path)"
|
||||||
}
|
}
|
||||||
|
|
||||||
$subItemObj = [PSCustomObject]@{
|
$subItemObj = [PSCustomObject]@{
|
||||||
filePath = $subItem.path
|
|
||||||
Path = $subItem.path
|
|
||||||
repoOwner = $repoOwner
|
|
||||||
repoName = $repoName
|
|
||||||
giteaURL = $giteaURL
|
|
||||||
downloadURL = $subItem.download_url
|
|
||||||
branch = $branch
|
|
||||||
type = $subItem.type
|
|
||||||
name = $subItem.name
|
name = $subItem.name
|
||||||
|
Path = $subItem.path
|
||||||
|
type = $subItem.type
|
||||||
size = $subItem.size
|
size = $subItem.size
|
||||||
sha = $subItem.sha
|
sha = $subItem.sha
|
||||||
|
downloadURL = $subItem.download_url
|
||||||
Success = $true
|
Success = $true
|
||||||
Error = $null
|
Error = $null
|
||||||
Level = $currentLevel
|
Level = $currentLevel
|
||||||
@@ -838,7 +843,6 @@ Function Get-GiteaChildItem {
|
|||||||
|
|
||||||
Write-Error "Failed to retrieve '$normalizedPath' from Gitea: $($_.Exception.Message)`n$($errorDetails | ConvertTo-Json -Depth 1 -Compress)"
|
Write-Error "Failed to retrieve '$normalizedPath' from Gitea: $($_.Exception.Message)`n$($errorDetails | ConvertTo-Json -Depth 1 -Compress)"
|
||||||
$results += [PSCustomObject]@{
|
$results += [PSCustomObject]@{
|
||||||
filePath = $normalizedPath
|
|
||||||
Path = $normalizedPath
|
Path = $normalizedPath
|
||||||
repoOwner = $repoOwner
|
repoOwner = $repoOwner
|
||||||
repoName = $repoName
|
repoName = $repoName
|
||||||
|
|||||||
Reference in New Issue
Block a user