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

Uploaded files size on hardware page is incorrect when using S3-like to get/store the files #11742

Closed
2 tasks done
dsferruzza opened this issue Aug 26, 2022 · 2 comments
Closed
2 tasks done

Comments

@dsferruzza
Copy link
Contributor

Debug mode

Describe the bug

My instance of Snipe-IT is hosted on Clever Cloud and I use their Ceph-based S3 Object Storage to store uploads.
Storing and reading files works well.

Since Snipe-IT 6.0.1 (or 6.0.0, I'm not sure) was released, I noticed that the /hardware/:id page was crashing (500 error) for hardware that had at least 1 uploaded file.
I found the issue and tested a patch on my instance successfully.
Basically: it works when using Storage::size() instead of filesize() because it follows Laravel's FS configuration instead of just trying to read a path on the local FS.
I found a related issue (#11150) and described my solution in a comment (#11150 (comment)) but as the issue was closed I suspect it was not read.
This issue was confirmed by @minkbear.

Since 6.0.10, this issue does not crash the page anymore (since @ was added in front of the call to filesize()), but the file size is still not correct.

Reproduction steps

  1. Configure a Snipe-IT instance ≥ 6.0.1 with S3 storage
  2. Create a hardware and store a file
  3. Go to the hardware page and the files tab, and check the displayed file size

Expected behavior

I expect the file size to be correct, as shown in the following screenshots.

Screenshots

With 6.0.10:

image

File size is incorrect.


With patched 6.0.10 (same data/config):

image

File size is correct.

Snipe-IT Version

6.0.10

Operating System

Linux (whatever Clever Cloud is using, I think it is Exherbo)

Web Server

Apache

PHP Version

8.0.21

Operating System

No response

Browser

No response

Version

No response

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

No response

Additional context

No response

@welcome
Copy link

welcome bot commented Aug 26, 2022

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

@snipe
Copy link
Owner

snipe commented Aug 26, 2022

Thanks for this report - sounds like you've already sussed out the fix - we'd happily take a PR for this.

snipe added a commit that referenced this issue Aug 29, 2022
Fixed #11742: display correct file sizes when using S3(-like) storage
@snipe snipe closed this as completed in f60ea95 Aug 29, 2022
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

2 participants