Repository navigation
fix: lk upload usa content type pela extensão e timeout no envio ao storage - #77
Merged
Merged
Conversation
There was a problem hiding this comment.
No issues found across 2 files
Requires human review: Corrige o content type do upload por extensão (docx/xlsx/pptx etc.) e adiciona --timeout (default 5m) no PUT ao storage, com testes. O default de 5m é um tradeoff operacional que precisa de validação.
Tip: Get a Slack DM when cubic finishes reviewing your PRs. Connect Slack
Turn on auto-fix | Re-trigger cubic
cirdes
approved these changes
Oct 27, 2026
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.
Issue relacionada
Parte A da LIN-8122
Descrição
lk uploadde.docx,.xlsxe.pptxsubia comoapplication/zip, porque o content type saía dos bytes. O backend recusa zip nos anexos de documento: o arquivo subia e o update seguinte falhava com 422. Agora o tipo vem da extensão, e sem extensão conhecida cai no sniff de antes.--content-typeexplícito continua ganhando.O Go não traz os tipos do Office nem
.csvsem o mime db do sistema, então coloquei uma tabelinha eminternal/commands/upload.gocopiada doapp/models/uploads/allowed_content_types.rbdo linkana. O preço é manter as duas iguais na mão.O PUT no storage usava
http.DefaultClient, sem timeout. Agora tem--timeout(default 5m): estourou, sai com exit 1 dizendo o arquivo e quanto esperou. OSURFACE.txtfica igual, ele só lista comandos.A parte B (manifest dos comandos novos e release) vai em outro PR, depois da LIN-8114 e da LIN-8116.
Instruções de teste
make test,make lintemake cover(95.5%).make build,./lk config set base_url http://localhost:3000,./lk impersonate <usuário>,./lk upload --file x.docxdevolvecontent_typeapplication/vnd.openxmlformats-officedocument.wordprocessingml.document. O binário damaindevolveapplication/zippro mesmo arquivo../lk upload --file grande.pdf --timeout 1mssai com exit 1 eupload de grande.pdf sem resposta do storage após 1ms (--timeout).E2E contra o linkana local (arquivos fictícios)