Bug #17992
closed
filepond: Filter on file extension is case dependent
Added by Carsten Rose 5 months ago.
Updated about 2 months ago.
Description
- In
Form.parameter.accept = image/*,application/pdf,text/plain,.R,.r,.m,.rmd,.rnw,.zip
gesetzt.
- Eine Datei ausgewaehlt
test01.R
(das '.R' ist gross geschrieben)
- Macht filepond wirklich eine Konvertierung auf mimetype? In dem Fall haette `text/plain` greifen muessen!
Im accept
zusaetzlich `.R` anzugeben loesst das Problem nicht (es ist kein Mimetype in QFQ hinterlegt).
Achtung: fuer die rmd, rnw, r - Files gibt es alle moeglichen Schreibweisen, die User sind sehr kreativ.
Files
- Tracker changed from Support to Bug
- Assignee changed from Enis Nuredini to Carsten Rose
- Status changed from New to Priorize
- Status changed from Priorize to In Progress
Alternative Lösung:
FilePond.registerPlugin({
// This function will be called for each file added to the pond
fileValidateTypeDetectType: (source, type) => new Promise((resolve, reject) => {
// Use a regular expression or similar to extract the extension from the file name
const extension = source.name.split('.').pop().toLowerCase();
// Define the allowed extensions
const allowedExtensions = ['jpg', 'png', 'txt'];
// Check if the extension is in the allowed list
if (allowedExtensions.includes(extension)) {
// Resolve the type if the extension is allowed (you can just return the extension)
resolve(extension);
} else {
// Reject the file
reject('Invalid file type');
}
})
});
allowedExtensions müssen selbst gepflegt.
- Status changed from In Progress to ToDo
- Target version changed from 24.9.0 to 24.5.0
- Status changed from ToDo to Closed
Also available in: Atom
PDF