Skip to content

Conversation

@alvanrahimli
Copy link
Contributor

Introduced an optional 'dir' query parameter to specify nested upload paths. Updated the sample frontend to demonstrate usage with a nested 'test' directory.

Introduced an optional 'dir' query parameter to specify nested upload paths. Updated the sample frontend to demonstrate usage with a nested 'test' directory.
@themisir themisir merged commit db58a07 into themisir:main Mar 9, 2025
1 check passed
@themisir themisir requested a review from Copilot April 17, 2025 23:21
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for uploading files to nested directories by introducing an optional "dir" query parameter for file uploads and updating the routing configuration accordingly.

  • Added a nested directory upload form in the sample frontend.
  • Modified Program.cs and RouterExtensions.cs to accept an allowSubDirectories flag.
  • Updated the UploadHandler to enforce the subdirectory restriction and construct the correct file key.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/Upload.Web.Sample/wwwroot/index.html Added a form for nested directory uploads using the "dir" query parameter.
src/Upload.Web.Sample/Program.cs Updated route mappings to include an allowSubDirectories flag for different endpoints.
src/Upload.Core/Web/UploadHandler.cs Enhanced file upload logic to handle a "dir" parameter and enforce directory restrictions.
src/Upload.Core/Web/RouterExtensions.cs Modified endpoint mapping extension to pass the allowSubDirectories parameter to the handler.

var fullKey = uploadPath is null
? key : Path.Combine(uploadPath, key);

KeyUtils.MushBeSafeKey(fullKey);
Copy link

Copilot AI Apr 17, 2025

Choose a reason for hiding this comment

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

It appears that there may be a typo in the function name 'MushBeSafeKey'. It is likely intended to be 'MustBeSafeKey'.

Suggested change
KeyUtils.MushBeSafeKey(fullKey);
KeyUtils.MustBeSafeKey(fullKey);

Copilot uses AI. Check for mistakes.
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.

2 participants