Repository navigation
fix: extension de arquivo non persiste ao subir - #35
Merged
Merged
Conversation
AsierCL
added a commit
that referenced
this pull request
Nov 5, 2026
* test: share one FK-ordered database cleaner across integration tests 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. * fix(upload): sanitize the client filename before persisting it 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. * refactor(dev): check the environment guard before stripping quotes 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. * docs: record the new filename tests and the shared test cleaner - 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. * docs: keep the suite sections in numeric 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.
engade unha columna varchar(255)
original_filenameafilese atemp_files, con script de migraciónV9__file_original_filename.sqlFileServiceImpl.downloadFileeFileProposalServiceImpl.getFileDownloadLinkcreanContent-Dispositionempregando o campo deoriginal_filenamepara manter o nome de arquivo co que subiu o usuario contribuidor (e polo tanto preserva a terminación de arquivo)