Skip to content

Relax fileExtension requirement in attachmentQueue #269

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

n0mad-d3v
Copy link

Hello powersync team 👋

This PR fixes #268 and updates the watchIds method in the Attachments helper to make the fileExtension parameter optional. This enables support for storing files with different extensions in the same attachmentQueue, which is useful in cases where:

  • The extension is already part of the filename (e.g., managed directly in the storage bucket like Supabase).
  • The developer wants more flexibility in handling mixed file types under a unified queue.

Motivation: Currently, the API assumes a single extension per queue, which limits use cases that involve multiple file types. Making fileExtension optional opens up broader usage while maintaining backward compatibility.

⚠️ This includes a breaking change. And along that, I'm wondering if it shouldn't be pushed further to be able to specify a Map<String, String?> for <filename, extension?> in the whatchIds to allow even more flexibility and usecases.

This change was inspired by this Discord thread.

WDYT? Looking forward to feedback!

PS: There is also a change about ensuring directory creation. In my usecase, I'm using Teams' ids as subdirectory so it's fully dynamic and my filename is like the following:
{teamId}/{attachmentType}/{attachmentId}.{attachmentExtension}.

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.

Attachments Helper – Allow Multiple File Extensions
1 participant