OneDrive - Wrong size for PNG files

2020-02-15 15:17发布

问题:

When uploading certain PNG files the size is incorrectly reported on the OneDrive website and in the Photo object returned by the REST API. This can be reproduced using the following PNG file:

http://www2.zippyshare.com/v/11270772/file.html

The file size is 20.3 KB, OneDrive displays it as 38.4 KB

It seems this only happens with PNG files that would be downsized/converted when the downsize_photo_uploads query param is absent or set to true. But the problem is not just limited to uploads using the REST API.

The problem has been already been reported here.

回答1:

Ryan from OneDrive here. We looked into this and have a good understanding of what's going wrong with the size. OneDrive computes the "space" a file takes up in our system by using the size of the largest data stream associated with a file. When an image is uploaded to OneDrive, we also create thumbnails for images so that we can quickly show various views in our clients and website.

In the case of this particular file, one of the JPG thumbnails we create for the PNG file is actually larger than the original file (due to the JPG compression not being as effective as PNG for this image). As a result, the thumbnail is actually the largest stream on the file. As you can imagine, that doesn't happen very often, but for this image (and others like it) we have this bug.

We have a bug tracking the issue and are investigating how we can fix the API to return the size of the "default" stream -- the stream that represents the actual contents of the file. I don't have an ETA for the fix, but we're working on it.



回答2:

FWIW, I appreciate your post, I discovered that is seems to be the same issue with the Android Onedrive SDK post I made a couple weeks ago

Does OneDrive change/re-encode jpg files?

It doesn't seem like anyone from MS is actually monitoring these SO tags very closely, so I'm creating a Github issue on the Android SDK, maybe that will produce an answer.

https://github.com/liveservices/LiveSDK-for-Android/issues/37



标签: onedrive