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

File adapters cannot dynamically set file location or filename during file creation because location used may not yet exist #9556

Open
AdrianCurtin opened this issue Jan 16, 2025 · 1 comment · May be fixed by #9557
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@AdrianCurtin
Copy link

New Issue Checklist

Issue Description

File adapters cannot set file location during file creation if file name will be changed during file creation. This issue has specific effects on the s3 file adapter, but may apply to any specific file adapter for the platform.

Steps to reproduce

  1. Using s3 file adapter, enable generateKey for filenames (such as (filename) => ${Date.now()}_${filename})
  2. (optional) disable preserveFileName
  3. Upload/ Create a file via a client application

Actual Outcome

  1. File "Image.jpeg" will be uploaded to S3 via the desired key "/TODAY_Image.jpeg" (or prepended with a hex string if preserveFileName is disabled eg: "/ABCDEF123_TODAY_Image.jpeg)
  2. File location will be returned and stored as "s3://ABCDEF123_Image.jpeg" and filename will be returned as "ABCDEF123_Image.jpeg"

Expected Outcome

  1. File "Image.jpeg" will be uploaded and filename will be modified as desired
  2. File Location and filename will reflect changes made during createFile

Environment

~parse-server 8.0.0-alpha.6 (but should be identical on 7.3)
~@parse/s3-files-adapter 4 (but should be identical for 4)

Server

  • Parse Server version: 8.0.0-alpha.6
  • Operating system: OSX
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Local and Heroku

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: 7
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): MongoDB Atlas

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): JavaScript
  • SDK version: Unkown

Code in question is here

const location = await this.adapter.getFileLocation(config, filename);

Copy link

parse-github-assistant bot commented Jan 16, 2025

Thanks for opening this issue!

  • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

@AdrianCurtin AdrianCurtin changed the title File adapters cannot properly set file location during file creation because location used may not yet exist File adapters cannot dynamically set file location or filename during file creation because location used may not yet exist Jan 16, 2025
@mtrezza mtrezza added type:feature New feature or improvement of existing feature type:bug Impaired feature or lacking behavior that is likely assumed and removed type:feature New feature or improvement of existing feature labels Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
2 participants