Skip to content

fix: remove empty transform struct when generating document URLs #6

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

Merged

Conversation

douglastofoli
Copy link
Contributor

Problem

When generating signed URLs for documents, the transform field was being sent as an empty struct (%Transform{}). This caused the Supabase backend to attempt applying image transformations to documents. The backend expects transform to be nil when not used, especially for non-image files like documents.

Solution

  • Updated the code to set transform to nil when not provided or explicitly set to nil in the options.
  • Modified the request body to include the transform field only when it is not nil

Rationale

This fix ensures that the Supabase backend does not attempt to apply image transformations to documents, avoiding unnecessary errors. By conditionally including the transform field, the request is cleaner and more accurate. The solution is simple, maintains backward compatibility, and works seamlessly for both document and image URL generation.

@zoedsoupe zoedsoupe merged commit d4fa082 into supabase-community:main Apr 5, 2025
3 checks passed
@zoedsoupe zoedsoupe mentioned this pull request Jul 15, 2025
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.

2 participants