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

Previous submission file #1016

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

thremilien
Copy link
Contributor

Remove file preview if non pdf file.

Replace download button action by downloading the file instead of displaying it in the browser which can lead to some issues (#868)

@thremilien
Copy link
Contributor Author

need to reminified js

@@ -762,7 +762,7 @@ function load_input_file(submissionid, key, input)
var input_file = $('#download-input-file-' + key);
input_file.attr('href', url );
input_file.css('display', 'block');
if(allowed_exts.indexOf(".pdf") >= 0) {
if(input[key]["filename"].endsWith('.pdf')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove the allowed_ext definition if it is not used anymore.

Apart from this, where is load_input_file() used ?

Comment on lines +109 to +113
if not filename.lower().endswith(".pdf"):
headers = {
'Content-Disposition': f'attachment; filename="{filename}"'
}
return Response(response=file_content, content_type=mime_type[0], headers=headers)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why having a difference in behavior if the file is a PDF ? I think the best is to download it as any other file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feature has been asked by the professor using INGInious. When you need to review multiple pdf file it's easier to just display it in the browser than downloading all the pdf files on the professor personnal computer. Since the other type of files cannot be directly shown in the browser using a built in feature, we only display pdf files

@nrybowski nrybowski force-pushed the master branch 2 times, most recently from e53b0e2 to 9a6d192 Compare December 21, 2024 13:51
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

Successfully merging this pull request may close these issues.

2 participants