Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The snippets API was failing due to improper URL encoding of the filename parameter #1878

Merged
merged 1 commit into from Feb 10, 2024
Merged

The snippets API was failing due to improper URL encoding of the filename parameter #1878

merged 1 commit into from Feb 10, 2024

Conversation

Sild
Copy link
Contributor

@Sild Sild commented Feb 7, 2024

GitLab api error:

GET https://gitlab.ZZZ.com/api/v4/snippets/YYY/files/HEAD/version 1/raw: 404 {message: 404 File Not Found}'

Root Cause:

The filename contains spaces which need to be properly encoded in the URL path. url.QueryEscape was being used instead of PathEscape.

Resolution:

Use PathEscape when encoding the filename since it is part of the URL path rather than query parameters. After applying this change, the snippets API works correctly.

Please let me know if you have any other questions!

Copy link
Member

@svanharmelen svanharmelen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍🏻

@svanharmelen svanharmelen merged commit b61ed28 into xanzy:main Feb 10, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants