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

Getting an error when accessing a file with size 0 bytes #609

Open
guillogo opened this issue May 3, 2024 · 0 comments
Open

Getting an error when accessing a file with size 0 bytes #609

guillogo opened this issue May 3, 2024 · 0 comments

Comments

@guillogo
Copy link
Contributor

guillogo commented May 3, 2024

Hi all,

I am facing an issue when using objectfs and uploading a file of 0 bytes to Moodle. Whenever I try to access the file, I get an error message. I understand it may sound strange to upload an empty file, but some scorms unfortunately contain references to such files.

Cannot read file 'empty_file0.txt'. Either the file does not exist or there is a permission problem.

[More information about this error](http://docs.moodle.org/401/fr_ca/error/moodle/storedfilecannotreadfile)

Debug info:
Error code: storedfilecannotreadfile
Stack trace:
line 64 of /admin/tool/objectfs/classes/local/store/s3/file_system.php: file_exception thrown
line 444 of /lib/filestorage/stored_file.php: call to tool_objectfs\local\store\s3\file_system->readfile()
line 2335 of /lib/filelib.php: call to stored_file->readfile()
line 2612 of /lib/filelib.php: call to readfile_accel()
line 2766 of /lib/filelib.php: call to send_file()
line 420 of /mod/resource/lib.php: call to send_stored_file()
line 5221 of /lib/filelib.php: call to resource_pluginfile()
line 44 of /pluginfile.php: call to file_pluginfile()

Here are the steps to replicate the issue:

  1. Add a file resource to a course.
  2. Upload the empty_file0.zip file using the file chooser empty_file0.zip
  3. Unzip the file inside the file chooser.
  4. Save the changes.
  5. Click on the new file resource created.

The above steps simulate uploading a SCORM file with a 0-byte file init and referenced.

The error occurs because the file has 0 bytes. The Minimum size threshold (bytes) setting is set to 0.

I am wondering if this is intentional. The file can be accessed/downloaded without issues when objectfs is not used, though.

Thank you!

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