diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 137f485..a7ba4b2 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -75,10 +75,10 @@ jobs: echo "Uploading ${filename}..." # Check if asset already exists and delete it - EXISTING_ID=$(curl -sS \ + EXISTING_ID=$(export ASSET_NAME="${filename}"; curl -sS \ -H "Authorization: token ${GITEA_TOKEN}" \ "${GITEA_URL}/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets" \ - | python3 -c "import json,sys; assets=json.load(sys.stdin); print(next((str(a['id']) for a in assets if a['name']=='${filename}'),''))" 2>/dev/null) + | python3 -c "import json,sys,os; name=os.environ['ASSET_NAME']; assets=json.load(sys.stdin); print(next((str(a['id']) for a in assets if a['name']==name),''))" 2>/dev/null) if [ -n "$EXISTING_ID" ]; then echo " Asset ${filename} already exists (id=${EXISTING_ID}), deleting..." diff --git a/gitea/client.go b/gitea/client.go index be1e553..5e202da 100644 --- a/gitea/client.go +++ b/gitea/client.go @@ -281,7 +281,7 @@ func (c *Client) GetAllFilesInPath(ctx context.Context, owner, repo, path string // 404 means the path might be a file — try fetching directly content, fileErr := c.GetFileContent(ctx, owner, repo, path) if fileErr != nil { - return nil, fmt.Errorf("path %q is neither a file nor directory: %w", path, err) + return nil, fmt.Errorf("path %q is neither a file nor directory: %w", path, fileErr) } results[path] = content return results, nil