Skip to content

Preserve directory structure from filename when generating S3 object key #16008

Description

@Cpidar

What happended?

The current implementation of the S3 file provider ignores the directory portion of filename when generating the object key.

For example:

{
  filename: "vendor_123/logo.png"
}

The provider parses the filename but only uses parsedFilename.name and parsedFilename.ext, resulting in an object key similar to:

logo-<timestamp>.png

instead of:

vendor_123/logo-<timestamp>.png

As a result, any directory structure supplied by the caller is lost.

Expected behavior

If filename contains a directory, it should be preserved when constructing the object key.

For example:

Input:

filename: "vendor_123/logo.png"

Current key:

logo-1752345678901.png

Expected key:

vendor_123/logo-1752345678901.png

If filename does not contain a directory, behavior should remain unchanged.

Actual behavior

For example:

{
  filename: "vendor_123/logo.png"
}

The provider parses the filename but only uses parsedFilename.name and parsedFilename.ext, resulting in an object key similar to:

logo-<timestamp>.png

instead of:

vendor_123/logo-<timestamp>.png

Link to reproduction repo


Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions