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

fix(upload): error on upload with the same filename #258

Merged
merged 1 commit into from
Mar 8, 2024

Conversation

tessus
Copy link
Collaborator

@tessus tessus commented Mar 8, 2024

Description

Currently it is possible to upload files with the same name. This is undefined behavior. e.g. which file should be returned when accessing it?

To solve this problem this change introduces a check whether a file (that hasn't expired) alredy exists with the same name. If so, an error will be returned.

Motivation and Context

see #241

I am opening this PR now, because I want to check, whether the test that fails in #246 also fails with this one.

Depending on which PR is merged first, a change will be required to add an .await to the glob_match_file call.

How Has This Been Tested?

  • manually
  • cargo tests (new tests)
  • fixtures (new tests)

Changelog Entry

### Changed

- Return an error when a file with the same name already exists on the server

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (no code change)
  • Refactor (refactoring production code)
  • Other

Checklist:

  • My code follows the code style of this project.
  • I have updated the documentation accordingly.
  • I have formatted the code with rustfmt.
  • I checked the lints with clippy.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@tessus tessus requested a review from orhun as a code owner March 8, 2024 00:02
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 83.33333% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 70.21%. Comparing base (fa5105d) to head (1266766).

Files Patch % Lines
src/paste.rs 83.33% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #258      +/-   ##
==========================================
+ Coverage   70.09%   70.21%   +0.12%     
==========================================
  Files          11       11              
  Lines         632      638       +6     
==========================================
+ Hits          443      448       +5     
- Misses        189      190       +1     
Flag Coverage Δ
unit-tests 70.21% <83.33%> (+0.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

src/server.rs Show resolved Hide resolved
Copy link
Owner

@orhun orhun left a comment

Choose a reason for hiding this comment

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

LGTM!

@orhun orhun merged commit 4987cfe into orhun:master Mar 8, 2024
8 checks passed
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.

3 participants