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

[Bug]: Markdown to PDF Conversion Allows Uploading of Non-Markdown Files #2218

Closed
1 task done
MaratheHarshad opened this issue Nov 12, 2024 · 1 comment · Fixed by #2219
Closed
1 task done

[Bug]: Markdown to PDF Conversion Allows Uploading of Non-Markdown Files #2218

MaratheHarshad opened this issue Nov 12, 2024 · 1 comment · Fixed by #2219
Labels
Front End Issues or pull requests related to front-end development

Comments

@MaratheHarshad
Copy link
Contributor

Installation Method

None

The Problem

Description:

Currently, the file input for the "Markdown to PDF" feature accepts all types of files, including non-Markdown files. To prevent errors and ensure the correct files are processed, the input should be restricted to only accept .md (Markdown) files.

Feature URL: https://stirlingpdf.io/markdown-to-pdf

Steps to Reproduce:

  1. Go to the "Markdown to PDF" feature page.
  2. Open the file input dialog.
  3. Notice that it accepts all types of files, including .pdf, .txt, .docx, etc.

Screenshots:

input
error

Expected Behavior:
The file input should only accept .md files for conversion, and any other file types should be rejected.

Suggested Solution:
Modify the file input HTML to use accept=".md".

Version of Stirling-PDF

0.32.0

Last Working Version of Stirling-PDF

No response

Page Where the Problem Occurred

https://stirlingpdf.io/markdown-to-pdf

Docker Configuration

No response

Relevant Log Output

No response

Additional Information

No response

Browsers Affected

No response

No Duplicate of the Issue

  • I have verified that there are no existing issues raised related to my problem.
Copy link

dosubot bot commented Nov 12, 2024

Hey there, @MaratheHarshad! I'm here to help you with any bugs, questions, or contributions. Let me know how I can assist you!

To address the issue of the "Markdown to PDF" feature accepting non-Markdown files, you can modify the HTML file input element to restrict it to only accept .md files. This can be done by setting the accept attribute to .md in the file input element. Here's how you can implement this change:

<div th:replace="~{fragments/common :: fileSelector(name='fileInput', multipleInputsForSingleRequest=false, accept='.md')}"></div>

This modification will ensure that the file input only allows files with the .md extension to be selected, preventing errors with non-Markdown files [1].

To continue talking to Dosu, mention @dosu.

@dosubot dosubot bot added the Front End Issues or pull requests related to front-end development label Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Front End Issues or pull requests related to front-end development
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant