Repository navigation
Fix/upload filename and polish - #38
Merged
Merged
Conversation
The test profile shares a single in-memory H2 across test classes, so every class has to clean up after the previous one. AuthRateLimitIntegrationTest only deleted users, which broke as soon as GovernanceRulesIntegrationTest ran right before it in CI (file_proposal FK). GlobalJourneyIntegrationTest had the full ordered list; AuthRateLimit got a copy. Two lists drift. Move the order into TestDatabaseCleaner and use it from all three classes. Verified: 129/129 in default order and with -Dsurefire.runOrder=reversealphabetical; GovernanceRulesIntegrationTest -> AuthRateLimitIntegrationTest passes.
The original filename comes from the client and is stored in original_filename varchar(255); it also travels in the Content-Disposition of the download URL. Two cases broke: - a name longer than the column made the upload fail with 409 DATA_INTEGRITY_ERROR (found while verifying #35); - a name with path components ('../../etc/notas.pdf') was stored as-is. FileNames.sanitize keeps the last path segment, drops control characters and truncates to 255 characters preserving the extension. It is applied on upload and again when building the Content-Disposition, so rows stored before this change are also safe. Tests (new OriginalFilenameIntegrationTest) assert the visible effect: the filename declared in the signed download URL. Verified RED first: long name -> 409, path kept. GREEN after the change.
The loader checked whether the key was already defined after doing the quote-stripping work. Checking right after validating the key is equivalent and skips work that was thrown away.
- 126 -> 129 tests, 17 -> 18 suite classes. - OriginalFilenameIntegrationTest documented (long name, path components, normal name) and what it actually asserts. - The migration negative case is a manual probe, not an automated test. - TestDatabaseCleaner is the single place for the FK-safe cleanup order.
Section 18 was inserted before 17, and the previous fix attempt moved it past the coverage summary. 15..18 now run in order and the summary stays last. Found by the review of this same PR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.