Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sporadic Incorrect File Extension Detection #317

Open
karatugo opened this issue Apr 16, 2024 · 0 comments
Open

Sporadic Incorrect File Extension Detection #317

karatugo opened this issue Apr 16, 2024 · 0 comments
Assignees

Comments

@karatugo
Copy link
Member

Description:
The get_ext method intermittently fails to correctly determine the file extensions during the get_submitted_files process. This issue appears to arise from the method's reliance on magic.Magic to derive file type descriptions, which may not always be accurate or specific enough to deduce the correct file extension.

Steps to Reproduce:

  1. Submit a file through get_submitted_files.
  2. The file reaches get_ext method.
  3. Observe that the output sometimes incorrectly identifies or appends the file extension based on its content description.

Expected Behavior:
The get_ext method should consistently and accurately determine the correct file extension based on the file's actual type and content.

Actual Behavior:
The method occasionally assigns incorrect file extensions, particularly when the magic.Magic description is too generic or misinterprets the file’s content (e.g., misidentifying text files as gzip due to content encoding).

Possible Solution:
Consider using a combination of MIME type detection and actual file extensions to enhance accuracy. Adjusting the magic configuration to yield more precise results or directly parsing file extensions could mitigate this issue.

Additional Information:
This error does not occur for all files but has been noted sporadically across different file types, complicating the debugging process. A review of how file descriptions are parsed and used in extension determination might be necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant