-
-
Notifications
You must be signed in to change notification settings - Fork 165
unusual characters in an uploaded file #2690
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
Comments
drgrice1
added a commit
to drgrice1/webwork2
that referenced
this issue
Apr 3, 2025
Of course then the file also has to be read as UTF-8. This fixes issue openwebwork#2690.
drgrice1
added a commit
to drgrice1/webwork2
that referenced
this issue
Apr 3, 2025
This takes advantage of things available with Mojolicious. This does not use `Data::UUID` anymore. A comment stated that it was overkill. It is and it was never a good idea to use that for this purpose. This just uses the `Mojo::Asset::Memory::to_file` method which converts to a `Mojo::Asset::File` object and saves the file to a temporary file using `Mojo::File::tempfile` (which uses `File::Temp` under the hood). That is guaranteed to give a safe filename that does not conflict with any existing files. Setting the environment variable `MOJO_TMPDIR` locally to be the passed in directory (which is `$ce->{webworkDirs}{uploadCache}`) ensures that the file is saved in the usual webwork2 upload location (although there is no need for that, and we could drop that configuration variable and just use the system temporary directory for this). The info file that is written is now UTF-8 encoded and decoded. This fixes issue openwebwork#2690. The `dir` option which was previously required and the only "option" is now just a required argument. It doesn't make sense to use an "option" hash things that are required. Particularly if there is only one option and it is required. Other than what is mentioned above the module behaves much the same.
This was referenced Apr 3, 2025
drgrice1
added a commit
to drgrice1/webwork2
that referenced
this issue
Apr 8, 2025
This takes advantage of things available with Mojolicious. This does not use `Data::UUID` anymore. A comment stated that it was overkill. It is and it was never a good idea to use that for this purpose. This just uses the `Mojo::Asset::Memory::to_file` method which converts to a `Mojo::Asset::File` object and saves the file to a temporary file using `Mojo::File::tempfile` (which uses `File::Temp` under the hood). That is guaranteed to give a safe filename that does not conflict with any existing files. Setting the environment variable `MOJO_TMPDIR` locally to be the passed in directory (which is `$ce->{webworkDirs}{uploadCache}`) ensures that the file is saved in the usual webwork2 upload location (although there is no need for that, and we could drop that configuration variable and just use the system temporary directory for this). The info file that is written is now UTF-8 encoded and decoded. This fixes issue openwebwork#2690. The `dir` option which was previously required and the only "option" is now just a required argument. It doesn't make sense to use an "option" hash things that are required. Particularly if there is only one option and it is required. Other than what is mentioned above the module behaves much the same.
drgrice1
added a commit
to drgrice1/webwork2
that referenced
this issue
Apr 8, 2025
This takes advantage of things available with Mojolicious. This does not use `Data::UUID` anymore. A comment stated that it was overkill. It is and it was never a good idea to use that for this purpose. This just uses the `Mojo::Asset::Memory::to_file` method which converts to a `Mojo::Asset::File` object and saves the file to a temporary file using `Mojo::File::tempfile` (which uses `File::Temp` under the hood). That is guaranteed to give a safe filename that does not conflict with any existing files. Setting the environment variable `MOJO_TMPDIR` locally to be the passed in directory (which is `$ce->{webworkDirs}{uploadCache}`) ensures that the file is saved in the usual webwork2 upload location (although there is no need for that, and we could drop that configuration variable and just use the system temporary directory for this). The info file that is written is now UTF-8 encoded and decoded. This fixes issue openwebwork#2690. The `dir` option which was previously required and the only "option" is now just a required argument. It doesn't make sense to use an "option" hash things that are required. Particularly if there is only one option and it is required. Other than what is mentioned above the module behaves much the same.
drgrice1
added a commit
to drgrice1/webwork2
that referenced
this issue
Apr 15, 2025
This takes advantage of things available with Mojolicious. This does not use `Data::UUID` anymore. A comment stated that it was overkill. It is and it was never a good idea to use that for this purpose. This just uses the `Mojo::Asset::Memory::to_file` method which converts to a `Mojo::Asset::File` object and saves the file to a temporary file using `Mojo::File::tempfile` (which uses `File::Temp` under the hood). That is guaranteed to give a safe filename that does not conflict with any existing files. Setting the environment variable `MOJO_TMPDIR` locally to be the passed in directory (which is `$ce->{webworkDirs}{uploadCache}`) ensures that the file is saved in the usual webwork2 upload location (although there is no need for that, and we could drop that configuration variable and just use the system temporary directory for this). The info file that is written is now UTF-8 encoded and decoded. This fixes issue openwebwork#2690. The `dir` option which was previously required and the only "option" is now just a required argument. It doesn't make sense to use an "option" hash things that are required. Particularly if there is only one option and it is required. Other than what is mentioned above the module behaves much the same.
drgrice1
added a commit
to drgrice1/webwork2
that referenced
this issue
Apr 15, 2025
This takes advantage of things available with Mojolicious. This does not use `Data::UUID` anymore. A comment stated that it was overkill. It is and it was never a good idea to use that for this purpose. This just uses the `Mojo::Asset::Memory::to_file` method which converts to a `Mojo::Asset::File` object and saves the file to a temporary file using `Mojo::File::tempfile` (which uses `File::Temp` under the hood). That is guaranteed to give a safe filename that does not conflict with any existing files. Setting the environment variable `MOJO_TMPDIR` locally to be the passed in directory (which is `$ce->{webworkDirs}{uploadCache}`) ensures that the file is saved in the usual webwork2 upload location (although there is no need for that, and we could drop that configuration variable and just use the system temporary directory for this). The info file that is written is now UTF-8 encoded and decoded. This fixes issue openwebwork#2690. The `dir` option which was previously required and the only "option" is now just a required argument. It doesn't make sense to use an "option" hash things that are required. Particularly if there is only one option and it is required. Other than what is mentioned above the module behaves much the same.
drgrice1
added a commit
to drgrice1/webwork2
that referenced
this issue
Apr 22, 2025
This takes advantage of things available with Mojolicious. This does not use `Data::UUID` anymore. A comment stated that it was overkill. It is and it was never a good idea to use that for this purpose. This just uses the `Mojo::Asset::Memory::to_file` method which converts to a `Mojo::Asset::File` object and saves the file to a temporary file using `Mojo::File::tempfile` (which uses `File::Temp` under the hood). That is guaranteed to give a safe filename that does not conflict with any existing files. Setting the environment variable `MOJO_TMPDIR` locally to be the passed in directory (which is `$ce->{webworkDirs}{uploadCache}`) ensures that the file is saved in the usual webwork2 upload location (although there is no need for that, and we could drop that configuration variable and just use the system temporary directory for this). The info file that is written is now UTF-8 encoded and decoded. This fixes issue openwebwork#2690. The `dir` option which was previously required and the only "option" is now just a required argument. It doesn't make sense to use an "option" hash things that are required. Particularly if there is only one option and it is required. Other than what is mentioned above the module behaves much the same.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On develop, a student used the Email Instructor button and attached a file with name
Screenshot 2025-04-01 at 3.22.24 PM.png
. This led to them getting an error message about a wide character fromlib/WeBWorK/Upload.pm
line 117. (The image and message did make it to the instructor.)The text was updated successfully, but these errors were encountered: