Skip to content

feat: Revise createFile logic to return modified filenames and location #242

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 16 commits into
base: master
Choose a base branch
from

Conversation

AdrianCurtin
Copy link

@AdrianCurtin AdrianCurtin commented Jan 16, 2025

  • Add error handling for key generation
  • Standardize return object with location, url (possibly signed), and filename / key without prefix
  • Add support for optional config parameter to allow getFileLocation to be called internally (prevent a double call from the serverside potentially)
  • Return s3 response explicitly as a separate variable

If parse-community/parse-server#9557 is merged,
this will address #237

This change will affect specific tests that check the response.Location argument and may affect any direct adapter usage of createFile that explicitly uses the s3 server response.

Closes: #237

Summary by CodeRabbit

  • New Features

    • File uploads now return a structured object: location (lowercase), name, and optionally url when config is provided.
    • Optional presigned/direct URL is returned when additional configuration is supplied.
    • Improved and validated key-generation flow for uploaded files (supports sync/async and rejects invalid results).
  • Tests

    • Added tests for optional URL generation, various endpoint URL constructions, and key-generation behaviors and error cases.
    • Updated tests to use the new response format.

Copy link

parse-github-assistant bot commented Jan 16, 2025

Thanks for opening this pull request!

@AdrianCurtin AdrianCurtin changed the title Revise createFile logic to preserve key & location bug: Revise createFile logic to preserve key & location Jan 16, 2025
@AdrianCurtin AdrianCurtin changed the title bug: Revise createFile logic to preserve key & location feat: Revise createFile logic to return modified filenames and location Jan 17, 2025
Copy link

codecov bot commented Jan 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.24%. Comparing base (3450527) to head (4c987ec).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #242      +/-   ##
==========================================
+ Coverage   97.18%   97.24%   +0.06%     
==========================================
  Files           2        2              
  Lines         213      218       +5     
==========================================
+ Hits          207      212       +5     
  Misses          6        6              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@mtrezza mtrezza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what the status of this PR is, but there are tests failing.

@AdrianCurtin
Copy link
Author

@mtrezza Which tests are failing?

@mtrezza
Copy link
Member

mtrezza commented Feb 1, 2025

See the CI job panel

@AdrianCurtin
Copy link
Author

@mtrezza Added tests for the two conditions that were missing

@mtrezza mtrezza requested a review from a team February 7, 2025 01:13
@AdrianCurtin
Copy link
Author

@mtrezza
that should clear up the lint and codecov report

@mtrezza
Copy link
Member

mtrezza commented Mar 8, 2025

@vahidalizad What do you think?

@vahidalizad
Copy link
Contributor

@mtrezza I think this is a good one! I had some minor change suggestions, but other than that, it looks great. I also reviewed the code in the Parse Server PR, which is necessary for this to work, and I think that looks good as well.

@mtrezza
Copy link
Member

mtrezza commented Mar 9, 2025

Great! Are you able to post your change suggestion here using the Review feature on GitHub? Or do you still require permissions for that?

@vahidalizad
Copy link
Contributor

vahidalizad commented Mar 10, 2025

Great! Are you able to post your change suggestion here using the Review feature on GitHub? Or do you still require permissions for that?

Yes, I created a review successfully!

@mtrezza
Copy link
Member

mtrezza commented Mar 11, 2025

Are you able to post the review in the "Files changed" tab? It should generate a GitHub comment here with your review feedback.

Copy link
Contributor

@vahidalizad vahidalizad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your work is well done! I think everything looks good overall, but I’ve suggested a few minor changes.

index.js Outdated

let key_without_prefix = filename;
if (this._generateKey instanceof Function) {
try {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe removing the try block would achieve the same result while preserving the original error trace and improving readability.

index.js Outdated
return {
location: location, // actual upload location, used for tests
name: key_without_prefix, // filename in storage, consistent with other adapters
s3_response: response, // raw s3 response
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need the s3_response key and we can remove it.

index.js Outdated
@@ -180,7 +187,17 @@ class S3Adapter {
const endpoint = this._endpoint || `https://${this._bucket}.s3.${this._region}.amazonaws.com`;
const location = `${endpoint}/${params.Key}`;

return Object.assign(response || {}, { Location: location });
let url;
if (Object.keys(config).length != 0) { // if config is passed, we can generate a presigned url here
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of checking only for the presence of keys, let's ensure we are checking for the correct keys.

Maybe change to:
if (config?.mount && config?.applicationId)

@mtrezza
Copy link
Member

mtrezza commented Mar 27, 2025

@AdrianCurtin just a friendly ping, did you get a chance to review the comments?

Copy link

coderabbitai bot commented Aug 13, 2025

📝 Walkthrough

Walkthrough

S3Adapter.createFile gained a final config parameter, computes the upload key once (supports sync/async generateKey and validates it), sets params.Key using the generated key, returns { location, name, url? }, and conditionally calls getFileLocation(config, key) to include a presigned/direct URL. Tests updated.

Changes

Cohort / File(s) Summary
S3Adapter core logic
index.js
Added config param to createFile; compute key_without_prefix via this._generateKey(filename, contentType, options) (supports sync/async and validates non-empty string); set params.Key = bucketPrefix + key_without_prefix; call PutObject; optionally call getFileLocation(config, key_without_prefix) when config provided; change return shape to { location, name, url? }.
Tests
spec/test.spec.js
Updated assertions to use value.location; added tests for presigned URL propagation; added/updated tests for sync/async generateKey behaviors, error handling, and validation; added URL-construction tests for various endpoint styles; mocked S3 client and getFileLocation where needed.

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant S3Adapter
  participant S3

  Caller->>S3Adapter: createFile(filename, data, contentType, options, config)
  alt _generateKey present
    S3Adapter->>S3Adapter: key := await _generateKey(filename, contentType, options)
    S3Adapter->>S3Adapter: validate key is non-empty string
  else
    S3Adapter->>S3Adapter: key := filename
  end
  S3Adapter->>S3: PutObject(Key = bucketPrefix + key, ...)
  S3-->>S3Adapter: s3_response
  opt config provided
    S3Adapter->>S3Adapter: url := await getFileLocation(config, key)
  end
  S3Adapter-->>Caller: { location, name: key, url? }
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Assessment against linked issues

Objective Addressed Explanation
Ensure uploaded object Key uses generated key consistently (#237)
Ensure returned location reflects generated key, not original filename (#237)
Ensure presigned/direct URL is generated using the generated key (#237)
Allow FilesController to obtain correct url/name from adapter without pre-calling getFileLocation (#237)

Possibly related PRs


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@parseplatformorg
Copy link
Contributor

parseplatformorg commented Aug 13, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

@AdrianCurtin
Copy link
Author

@mtrezza @vahidalizad

Revised! and thanks for your assistance!

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (2)
index.js (2)

192-197: Reconsider s3_response field (API surface and naming consistency)

  • Exposing the raw AWS response increases the public API surface with little consumer value and couples clients to SDK internals. Prior feedback suggested removing it.
  • If you keep it, prefer camelCase (s3Response) to match the file’s conventions.

Option A — remove it:

     return {
       location: location, // actual upload location, used for tests
       name: key_without_prefix, // filename in storage, consistent with other adapters
-      s3_response: response, // raw s3 response
       ...url ? { url: url } : {} // url (optionally presigned) or non-direct access url
     };

Option B — rename to camelCase:

     return {
       location: location, // actual upload location, used for tests
       name: key_without_prefix, // filename in storage, consistent with other adapters
-      s3_response: response, // raw s3 response
+      s3Response: response, // raw s3 response
       ...url ? { url: url } : {} // url (optionally presigned) or non-direct access url
     };

Note: If you choose Option B, please update the tests accordingly.


187-191: Only call getFileLocation when inputs are sufficient to avoid malformed URLs

If directAccess is false, calling getFileLocation with an arbitrary non-empty config can produce URLs with “undefined” segments. Gate this on the presence of required keys, or allow unconditionally only when directAccess is true. This aligns with the prior suggestion to check for config?.mount and config?.applicationId.

Apply this diff:

-    let url;
-    if (config && typeof config === 'object' && Object.keys(config).length > 0) { // if config is passed, we can generate a presigned url here
-      url = await this.getFileLocation(config, key_without_prefix);
-    }
+    let url;
+    const shouldResolveUrl =
+      config && typeof config === 'object' &&
+      (
+        this._directAccess // baseUrl flow doesn't require mount/applicationId
+        || (config?.mount && config?.applicationId) // needed when serving via parse-server
+      );
+    if (shouldResolveUrl) {
+      url = await this.getFileLocation(config, key_without_prefix);
+    }
🧹 Nitpick comments (1)
spec/test.spec.js (1)

871-903: Strengthen test by asserting getFileLocation was called with the expected args

This ensures createFile passes the final key (without prefix) and the provided config to getFileLocation.

Apply this diff inside the test after obtaining result:

       const result = await s3.createFile(
         'file.txt',
         'hello world',
         'text/utf8',
         {},
         { mount: 'http://example.com', applicationId: 'test123' }
       );
 
       expect(result).toEqual({
         location: jasmine.any(String),
         name: 'file.txt',
         s3_response: jasmine.any(Object),
         url: 'https://presigned-url.com/file.txt'
       });
+      expect(s3.getFileLocation).toHaveBeenCalledWith(
+        { mount: 'http://example.com', applicationId: 'test123' },
+        'file.txt'
+      );
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e634835 and 6a3b0cf.

📒 Files selected for processing (2)
  • index.js (2 hunks)
  • spec/test.spec.js (4 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
spec/test.spec.js (3)
lib/optionsFromArguments.js (1)
  • options (35-35)
spec/mocks/s3adapter.js (2)
  • s3 (11-15)
  • S3Adapter (2-2)
spec/support/server.js (1)
  • S3Adapter (8-8)
🔇 Additional comments (3)
spec/test.spec.js (3)

732-734: LGTM: asserts use new return shape (location)

Switching to value.location is correct with the updated adapter response.


743-745: LGTM: asserts use new return shape (location)

Consistent with the new API.


753-756: LGTM: asserts use new return shape (location)

Consistent with the updated adapter response.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (5)
index.js (1)

143-152: Async-safe generateKey handling looks good; consider rejecting whitespace-only keys

The async sync/await handling and type check are solid. One nit: whitespace-only strings currently pass; trim before validating to avoid uploading a key that is effectively empty.

Apply this diff:

-      if (typeof key_without_prefix !== 'string' || key_without_prefix.length === 0) {
+      if (typeof key_without_prefix !== 'string' || key_without_prefix.trim().length === 0) {
         throw new Error('generateKey must return a non-empty string');
       }
+      key_without_prefix = key_without_prefix.trim();
spec/test.spec.js (4)

871-902: Strengthen assertions: verify getFileLocation call args and gating

To ensure the URL path is exercised as intended, assert getFileLocation receives the expected config and key, and that the result includes url only when config is present.

Apply this diff:

       // Mock getFileLocation to return a presigned URL
-      spyOn(s3, 'getFileLocation').and.returnValue(Promise.resolve('https://presigned-url.com/file.txt'));
+      spyOn(s3, 'getFileLocation').and.returnValue(Promise.resolve('https://presigned-url.com/file.txt'));
@@
       const result = await s3.createFile(
         'file.txt',
         'hello world',
         'text/utf8',
         {},
         { mount: 'http://example.com', applicationId: 'test123' }
       );
 
+      expect(s3.getFileLocation).toHaveBeenCalledWith(
+        jasmine.objectContaining({ mount: 'http://example.com', applicationId: 'test123' }),
+        'file.txt'
+      );
       expect(result).toEqual({
         location: jasmine.any(String),
         name: 'file.txt',
         url: 'https://presigned-url.com/file.txt'
       });

919-939: Add an assertion for the returned name

You already assert the PutObjectCommand Key; also check the returned name matches the generated key.

Apply this diff:

-      await s3.createFile('file.txt', 'hello world', 'text/utf8', {});
+      const out = await s3.createFile('file.txt', 'hello world', 'text/utf8', {});
@@
-      expect(commandArg.input.Key).toBe('async-file.txt');
+      expect(commandArg.input.Key).toBe('async-file.txt');
+      expect(out.name).toBe('async-file.txt');

941-959: Mirror the name assertion for Promise-based generateKey

Same as the async function case, assert the returned name.

Apply this diff:

-      await s3.createFile('file.txt', 'hello world', 'text/utf8', {});
+      const out = await s3.createFile('file.txt', 'hello world', 'text/utf8', {});
@@
-      expect(commandArg.input.Key).toBe('promise-file.txt');
+      expect(commandArg.input.Key).toBe('promise-file.txt');
+      expect(out.name).toBe('promise-file.txt');

961-999: Add a test for whitespace-only return from generateKey

The current validation would accept ' ' without trimming. Either implement trim in the adapter (preferred) or add a test to capture the intended rejection.

Proposed test (add near the related generateKey validation tests):

+    it('should reject when generateKey returns only whitespace', async () => {
+      const options = {
+        bucket: 'bucket-1',
+        generateKey: () => '   '
+      };
+      const s3 = new S3Adapter(options);
+      s3._s3Client = s3ClientMock;
+
+      await expectAsync(
+        s3.createFile('file.txt', 'hello world', 'text/utf8', {})
+      ).toBeRejectedWithError('generateKey must return a non-empty string');
+    });
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6a3b0cf and bf88785.

📒 Files selected for processing (2)
  • index.js (2 hunks)
  • spec/test.spec.js (4 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
spec/test.spec.js (3)
lib/optionsFromArguments.js (1)
  • options (35-35)
spec/mocks/s3adapter.js (2)
  • s3 (11-15)
  • S3Adapter (2-2)
spec/support/server.js (1)
  • S3Adapter (8-8)
🔇 Additional comments (3)
index.js (2)

191-194: Good: getFileLocation is gated by required config keys

Gating on config?.mount and config?.applicationId prevents unnecessary calls and aligns with parse-server expectations.


196-201: Return shape is clean and forward-compatible

Returning { location, name, url? } improves clarity and avoids leaking S3 internals. Matches other adapters’ semantics.

spec/test.spec.js (1)

732-735: Tests correctly updated to consume value.location

Switching from value.Location to value.location matches the new return shape and keeps the assertions focused on the path component.

Also applies to: 742-746, 752-757

More tests and changes to make coderabbit happy
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
index.js (1)

211-214: Guarding getFileLocation with required config keys is correct

Matches earlier review feedback to only call when both mount and applicationId are present.

🧹 Nitpick comments (5)
index.js (3)

143-154: Nit: rename key_without_prefix to camelCase for consistency

Most variables in this file use camelCase (e.g., fileName, locationBase). Renaming improves readability and consistency.

-  async createFile(filename, data, contentType, options = {}, config = {}) {
-    let key_without_prefix = filename;
+  async createFile(filename, data, contentType, options = {}, config = {}) {
+    let keyWithoutPrefix = filename;
     if (typeof this._generateKey === 'function') {
       const candidate = this._generateKey(filename, contentType, options);
-      key_without_prefix =
+      keyWithoutPrefix =
         candidate && typeof candidate.then === 'function' ? await candidate : candidate;
-      if (typeof key_without_prefix !== 'string' || key_without_prefix.trim().length === 0) {
+      if (typeof keyWithoutPrefix !== 'string' || keyWithoutPrefix.trim().length === 0) {
         throw new Error('generateKey must return a non-empty string');
       }
-      key_without_prefix = key_without_prefix.trim();
+      keyWithoutPrefix = keyWithoutPrefix.trim();
     }
 
     const params = {
       Bucket: this._bucket,
-      Key: this._bucketPrefix + key_without_prefix,
+      Key: this._bucketPrefix + keyWithoutPrefix,
       Body: data,
     };
@@
-    let url;
-    if (config?.mount && config?.applicationId) { // if config has required properties for getFileLocation
-      url = await this.getFileLocation(config, key_without_prefix);
-    }
+    let url;
+    if (config?.mount && config?.applicationId) { // if config has required properties for getFileLocation
+      url = await this.getFileLocation(config, keyWithoutPrefix);
+    }
@@
-    return {
-      location: location, // actual upload location, used for tests
-      name: key_without_prefix, // filename in storage, consistent with other adapters
-      ...url ? { url: url } : {} // url (optionally presigned) or non-direct access url
-    };
+    return {
+      location: location, // actual upload location, used for tests
+      name: keyWithoutPrefix, // filename in storage, consistent with other adapters
+      ...url ? { url: url } : {} // url (optionally presigned) or non-direct access url
+    };

Also applies to: 157-157, 211-214, 216-220


188-209: Robust custom endpoint URL construction; consider a couple more edge cases in tests

This correctly handles path-style endpoints, virtual-hosted style, and endpoints with query strings. To further harden behavior, consider adding tests for:

  • Endpoints with a trailing slash (e.g., https://minio.example.com/)
  • IPv6-literal host endpoints (e.g., http://[::1]:9000) if you intend to support MinIO-style local setups

I can draft the tests if useful.


216-220: Optional: always include the url field for a stable return shape

If you prefer a consistent shape, you could always include url (undefined when not available). This avoids consumers having to check field presence.

-    return {
-      location: location, // actual upload location, used for tests
-      name: key_without_prefix, // filename in storage, consistent with other adapters
-      ...url ? { url: url } : {} // url (optionally presigned) or non-direct access url
-    };
+    return {
+      location,
+      name: keyWithoutPrefix,
+      url: url ?? undefined
+    };
spec/test.spec.js (2)

871-906: Good positive test for url with config; add a negative case to assert omission

Consider adding a companion test to assert that when config is missing required keys (e.g., only mount or only applicationId, or empty object), url is omitted and getFileLocation is not called.

Example test to add:

it('should not include url when config is missing required keys', async () => {
  const s3 = new S3Adapter({ bucket: 'bucket-1', presignedUrl: true });
  s3._s3Client = s3ClientMock;
  const spy = spyOn(s3, 'getFileLocation').and.callThrough();

  const result1 = await s3.createFile('file.txt', 'hello', 'text/plain', {}, {});
  expect(spy).not.toHaveBeenCalled();
  expect(result1.url).toBeUndefined();

  const result2 = await s3.createFile('file.txt', 'hello', 'text/plain', {}, { mount: 'http://x' });
  expect(spy).not.toHaveBeenCalled();
  expect(result2.url).toBeUndefined();

  const result3 = await s3.createFile('file.txt', 'hello', 'text/plain', {}, { applicationId: 'a' });
  expect(spy).not.toHaveBeenCalled();
  expect(result3.url).toBeUndefined();
});

1020-1100: LGTM: endpoint URL construction tests; add trailing-slash variant

Great coverage for query/path, path-style, virtual-hosted-style, malformed, and default AWS. Consider adding a trailing-slash endpoint to validate normalization:

Example test to add:

it('should handle endpoint with trailing slash', async () => {
  const s3 = new S3Adapter({
    bucket: 'test-bucket',
    s3overrides: { endpoint: 'https://minio.example.com/' }
  });
  s3._s3Client = s3ClientMock;
  const result = await s3.createFile('test.txt', 'hello world', 'text/utf8');
  expect(result.location).toBe('https://minio.example.com/test-bucket/test.txt');
});
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bf88785 and 2cac314.

📒 Files selected for processing (2)
  • index.js (2 hunks)
  • spec/test.spec.js (4 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
spec/test.spec.js (2)
spec/mocks/s3adapter.js (2)
  • s3 (11-15)
  • S3Adapter (2-2)
spec/support/server.js (1)
  • S3Adapter (8-8)
🔇 Additional comments (8)
index.js (1)

143-154: Async generateKey support and validation look solid

This correctly awaits async/thenable generateKey results and enforces a non-empty string return, preventing subtle S3 key bugs.

spec/test.spec.js (7)

732-734: LGTM: assertions updated to new return shape (value.location)

Using the WHATWG URL parser against value.location is appropriate.


743-745: LGTM: verification against bucketPrefix via value.location

This correctly reflects the new createFile return contract.


753-756: LGTM: path assertions adapted to value.location

Good coverage for prefixed path and filename placement.


908-922: LGTM: generateKey error propagation test

This verifies that thrown errors from generateKey reject createFile with the same error.


923-946: LGTM: async generateKey is awaited; return shape and Key verified

Good checks for both S3 command input.Key and returned name.


946-965: LGTM: Promise-based generateKey covered

Covers thenables distinct from async functions.


967-1017: LGTM: comprehensive validation of generateKey return types

Covers empty string, number, whitespace-only, and async null.

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.

Objects uploaded with generateKey return incorrect locations
4 participants