Skip to content

onedrive (SharePoint): file integrity check fails because SharePoint modifies specific files #2599

Open

Description

@Cnly

There have been multiple reports that SharePoint modifies files uploaded (mostly Office files), so this issue is opened to track the problem. Currently there seems to be no way to disable this behaviour, but a possible workaround is to set the length of the affected files to -1 and their hash to an empty string so they can be ignored.

Activity

  1. added this to the Known Problem milestone on Sep 20, 2018
  2. Cnly commented on Nov 8, 2018

    @Cnly
    MemberAuthor

    Update: There is an issue on OneDrive's side about this: OneDrive/onedrive-api-docs#935. Will keep tracking.

  3. jasontibbitts commented on Sep 10, 2019

    @jasontibbitts

    It doesn't appear that microsoft views this as a problem. I seem to be able to sync (without any verification, of course) using 1.48.0 if I pass --ignore-checksum --ignore-size. Is there a better way to get past this?

  4. WarpedPixel commented on Aug 8, 2020

    @WarpedPixel
    Contributor

    There is a workaround that worked for me described in issue #2036

  5. modified the milestones: Known Problem, v1.55 on Feb 9, 2021
  6. modified the milestones: v1.55, v1.56 on Apr 3, 2021
  7. modified the milestones: v1.56, v1.57 on Jul 20, 2021
  8. modified the milestones: v1.57, Known Problem on Nov 1, 2021
  9. dinger1986 commented on May 22, 2023

    @dinger1986

    sorry for resurrecting this old issue but we have done alot of testing with this and find that if --vfs-cache-mode is set to off it works fine every time uploading files, if its set to full or writes it needs --ignore-checksum --ignore-size xlsx files are corrupted, if it was just sharepoint then it would happen all the time I would have thought

  10. landall commented on Jul 4, 2023

    @landall
    Contributor

    I find some thing to do about this issue.
    This is a bug of SharePoint.
    After uploading, some files with certain extensions will be modified, 11-12 bytes longer than the original file.
    I try to upload the same file with a extension .xxx, this bug is not triggered.

    So maybe we can add a mode flag, uploading files with two steps, upload to a strange name and rename it to the correct name.

  11. dinger1986 commented on Jul 4, 2023

    @dinger1986

    A mode that would only cache for downloading but not uploading would probably work as well

  12. landall commented on Jul 5, 2023

    @landall
    Contributor

    I find out what SharePoint Backend is doing with one of my JPEG images.
    This JPEG seems to have a bad header information.
    The density in JPEG header is 96 x 96.
    The density in EXIF(which is JPEG APP1 Part) is 72 x 72.

    SharePoint modified the density in JPEG header to 72 x 72, and add 12bytes to EXIF part.
    All bytes in EXIF after the EXIF size-bytes is not modified, only 12 bytes appended.
    I don't know why, maybe a bug of Microsoft?

    It seems there is a filter program in the process of upload API, which is correcting the information of some files.
    But if you upload the file with a different extension and rename it to JPEG after uploading, this filter program does not work.

    I think this is a bug of SharePoint/OneDrive Business.
    It should not write back the corrected information to the uploaded file.

  13. dinger1986 commented on Jul 5, 2023

    @dinger1986

    Is vfs cache enabled?

  14. landall commented on Jul 5, 2023

    @landall
    Contributor

    Is vfs cache enabled?

    I checked this without rclone.
    I just call the Microsoft Graph File API to upload large file directly.

  15. landall commented on Jul 6, 2023

    @landall
    Contributor
  16. dinger1986 commented on Jul 6, 2023

    @dinger1986

    Done

  17. hgrbk commented on Oct 17, 2024

    @hgrbk

    The problem is that Sharepoint modifies some of the uploaded files by itself as soon as they are uploaded. Adding properties. Changing DPI etc. so they have different size and of course checksum.
    The solution is to set ParserDisable property of the destination Sharepoint list to True. Not in powershell, not in admin panel, not in Graph API.
    You can do it via Sharepoint REST api available at https://contoso.sharepoint.com/sites/abcd/_api/
    or use wrapper like the "CLI for Microsoft 365" tool.

  18. ncw commented on Oct 17, 2024

    @ncw
    Member

    @hjastr thank you for that. Do you think that is something we should put in the docs, or is that something rclone should do itself?

  19. hgrbk commented on Oct 18, 2024

    @hgrbk

    In my opinion there should be an option when creating new Sharepoint remote in rclone. And check of this attribute in sync and copy command with warning if not set. That would give users best experience.
    And imagine all of that time humanity will save on googling "Failed to copy: corrupted on transfer: QuickXorHash crypted hash differ."

  20. landall commented on Oct 19, 2024

    @landall
    Contributor

    @hjastr thank you for that. Do you think that is something we should put in the docs, or is that something rclone should do itself?

    I find a way to solve this problem.
    update with a safe filename and then rename it.
    this problem only happens in a small set of file extensions.
    for example,
    abc.jpg may be modified but abc.jpg.xxx never modified and no file will be modified after renaming.

  21. emombiela commented on Aug 4, 2026

    @emombiela

    I can confirm this is still happening with:

    rclone v1.74.4
    Ubuntu 24.04

    I reproduced the issue on multiple SharePoint document libraries and a newly created library.

    The same XLSX uploads correctly to OneDrive Business but not to SharePoint document libraries.

    After uploading the file through SharePoint Web UI and downloading it again, the file is physically modified by SharePoint.

    A diff between the original and downloaded XLSX shows:

    • customXml added
    • docProps/custom.xml added
    • ContentTypeId metadata added
    • multiple XML files modified

    The uploaded XLSX grows from 8811 bytes to approximately 14-15 KB.

    rclone then reports:

    corrupted on transfer: sizes differ

    and removes the uploaded file.

    This does not affect DOCX, ODS, CSV or TXT files.

    Only XLS/XLSX seem affected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions