Filenames of imported files are truncated improperly when containing multiple periods
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 65/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- javascript
- Ambito
- frontend
Direzione di ricerca
Inizia in src/lib/file-uploader.js, all’interno di extractFileName, e riproduci l’upload con un nome file contenente più punti. Verifica che il nome dell’asset importato rimuova solo l’estensione finale, ad esempio importando image.jpg.png come image.jpg, e controlla i flussi di upload interessati per sprite, costumi, sfondi e suoni.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Expected Behavior
When a file is uploaded to Scratch (whether as a sprite, costume, backdrop, sound, etc.), only the file extension should be removed from the filename, if it exists.
Because a file's extension is determined by the contents of the filename after the last period, if a filename has multiple periods, only the last period (and the characters that follow) should be removed when uploaded.
e.g. An image with the filename image.jpg.png is treated as a PNG, and thus should be imported with the asset name image.jpg if the intention is to remove only the file extension when importing files to Scratch.
Actual Behavior
If a file with more than one period in its name is imported, the filename is truncated to the first period, not the last.
This leads to the filename being truncated before the actual file extension.
Based on the code responsible for this behavior and its comments, this code appears to be working as intended, but I am still reporting this as an issue on the basis of that intended behavior being undesirable from my perspective.
From file-uploader.js:
const extractFileName = function (nameExt) {
// There could be multiple dots, but get the stuff before the first .
const nameParts = nameExt.split('.', 1); // we only care about the first .
return nameParts[0];
};
Steps to Reproduce
Steps to reproduce the behavior:
- Open the Scratch Editor (either via the Offline Editor or web browser)
- Click
Upload Sprite,Upload Backdrop,Upload Costume, orUpload Sound. - Select and upload a compatible file with more than one period in its filename.
System Details
Browser: Google Chrome 143.0.7499.170 (arm64)
Offline Editor: Version 3.31.1 (Downloaded from Mac App Store)
Operating System: macOS Tahoe 26.2
Screenshots
Original Filename: MAX.(period).png
Expected Behavior: Uploaded as costume named MAX.(period)
Actual Behavior: Uploaded as costume named MAX
- Lingua principale
- JavaScript
- Stelle
- 310
- Fork
- 299
- Merge medio
- 19h 41m
- PR unite (30g)
- 14
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di scratchfoundation/scratch-editor
-
scratch-paint's npm test does not run lint, so CI never lints paint; one lint error is currently in developForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
scratchfoundation/scratch-editor#754 ·
I maintainer di solito rispondono entro 1 giorno
-
spork
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
scratchfoundation/scratch-editor#646 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Fresh Windows checkout: lint, the root build and `scratch-gui` unit tests fail without any code changesForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 76/100
scratchfoundation/scratch-editor#750 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Monitor context menus shrink the EditorForse già presa @mxmou l’ha presa 3 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 50/100
scratchfoundation/scratch-editor#744 · 6 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Large SVG costumes exhaust memory during playback on low-RAM devices — no texture budget or warningAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
scratchfoundation/scratch-editor#722 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di scratchfoundation/scratch-editor
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Fei2411/DeepSeek-Bot#1113 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
arfct/timezone.fyi#19 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
fastify/fastify-http-proxy#493 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
eliasstravik/herdr-projects#785 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
tensorflow/tfjs#8754 ·