|
|
|
|
@@ -11,7 +11,7 @@ Function Set-GiteaConfiguration {
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Create configuration directory if it doesn't exist
|
|
|
|
|
$configDir = Join-Path -Path $env:USERPROFILE -ChildPath ".giteautils"
|
|
|
|
|
$configDir = Join-Path -Path $HOME -ChildPath ".giteautils"
|
|
|
|
|
if (-not (Test-Path -Path $configDir)) {
|
|
|
|
|
New-Item -Path $configDir -ItemType Directory | Out-Null
|
|
|
|
|
}
|
|
|
|
|
@@ -36,7 +36,7 @@ Function Get-GiteaConfiguration {
|
|
|
|
|
[switch]$Force
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
$configPath = Join-Path -Path $env:USERPROFILE -ChildPath ".giteautils\config.xml"
|
|
|
|
|
$configPath = Join-Path -Path $HOME -ChildPath ".giteautils/config.xml"
|
|
|
|
|
|
|
|
|
|
if (Test-Path -Path $configPath) {
|
|
|
|
|
$config = Import-Clixml -Path $configPath
|
|
|
|
|
@@ -180,6 +180,8 @@ Function Get-GiteaFileContent {
|
|
|
|
|
|
|
|
|
|
process {
|
|
|
|
|
foreach ($file in $filePath) {
|
|
|
|
|
# Normalize path separators for cross-platform compatibility
|
|
|
|
|
$file = $file -replace '\\', '/'
|
|
|
|
|
Write-Verbose "Processing file: $file"
|
|
|
|
|
$encodedFile = [System.Uri]::EscapeDataString($file)
|
|
|
|
|
Write-Verbose "Encoded file: $encodedFile"
|
|
|
|
|
@@ -191,7 +193,6 @@ Function Get-GiteaFileContent {
|
|
|
|
|
$url += "/$encodedFile"
|
|
|
|
|
$url += "?ref=$branch"
|
|
|
|
|
Write-Verbose "URL: $url"
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
$fileContent = Invoke-RestMethod -Uri $url -Method Get -Headers $headers
|
|
|
|
|
|
|
|
|
|
@@ -398,6 +399,8 @@ Function Invoke-GiteaFileDownload {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
process {
|
|
|
|
|
# Normalize path separators for cross-platform compatibility
|
|
|
|
|
$filePath = $filePath -replace '\\', '/'
|
|
|
|
|
Write-Verbose "File path: $filePath"
|
|
|
|
|
Write-Verbose "Type: $type"
|
|
|
|
|
|
|
|
|
|
@@ -664,11 +667,10 @@ Function Get-GiteaChildItem {
|
|
|
|
|
$paths = $path
|
|
|
|
|
foreach ($path in $paths) {
|
|
|
|
|
Write-Verbose "Processing path: $path"
|
|
|
|
|
# Normalize the path format - replace backslashes with forward slashes and trim trailing slashes
|
|
|
|
|
# Normalize path separators for cross-platform compatibility
|
|
|
|
|
$normalizedPath = $path -replace '\\', '/' -replace '/$', ''
|
|
|
|
|
$encodedPath = [System.Uri]::EscapeDataString($normalizedPath)
|
|
|
|
|
Write-Verbose "Normalized path: $normalizedPath"
|
|
|
|
|
Write-Verbose "Encoded path: $encodedPath"
|
|
|
|
|
$encodedPath = [System.Uri]::EscapeDataString($normalizedPath)
|
|
|
|
|
$url = "$giteaURL"
|
|
|
|
|
$url += "/api/v1/repos"
|
|
|
|
|
$url += "/$repoOwner"
|
|
|
|
|
|