Skip to content

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

@AdrianCurtin

Description

@AdrianCurtin

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);

Activity

parse-github-assistant

parse-github-assistant commented on Jan 16, 2025

@parse-github-assistant

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.
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[/+] on Jan 16, 2025
added
type:featureNew feature or improvement of existing feature
type:bugImpaired feature or lacking behavior that is likely assumed
and removed
type:featureNew feature or improvement of existing feature
on Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @mtrezza@AdrianCurtin

      Issue actions

        File adapters cannot dynamically set file location or filename during file creation because location used may not yet exist · Issue #9556 · parse-community/parse-server