Project

General

Profile

Actions

Bug #17992

closed

filepond: Filter on file extension is case dependent

Added by Carsten Rose 5 months ago. Updated about 2 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Carsten Rose
Target version:
Start date:
25.02.2024
Due date:
% Done:

0%

Estimated time:
Discuss:
Prio Planung:
No
Vote:

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

Actions #1

Updated by Carsten Rose 5 months ago

  • Tracker changed from Support to Bug
Actions #2

Updated by Enis Nuredini 5 months ago

  • Assignee changed from Enis Nuredini to Carsten Rose

Ja die Konvertierung macht Filepond selbst, aber nur bei Dateitypen die einen Mime-Type Standard besitzen. Bei .R z.b. ist dies nicht der Fall.
Nicht in folgendender Liste zu finden: https://mimetype.io/all-types
In dieser folgenden Liste ist die Extension eingetragen, jedoch auch wieder ohne einen Mime-Type Standard: https://de.wikipedia.org/wiki/Liste_von_Dateinamenserweiterungen/R

Actions #4

Updated by Enis Nuredini 3 months ago

  • Status changed from New to Priorize
Actions #5

Updated by Enis Nuredini 3 months ago

  • Status changed from Priorize to In Progress
Actions #6

Updated by Enis Nuredini 3 months ago

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.

Actions #7

Updated by Carsten Rose 3 months ago

  • Status changed from In Progress to ToDo
Actions #8

Updated by Carsten Rose about 2 months ago

  • Target version changed from 24.9.0 to 24.5.0
Actions #9

Updated by Carsten Rose about 2 months ago

  • Status changed from ToDo to Closed
Actions

Also available in: Atom PDF