• 
      

    Fix crashes when attempting to download newly-added empty files.

    Review Request #14995 — Created April 2, 2026 and submitted

    Information

    Review Board
    release-7.1.x

    Reviewers

    When a diff contained a newly-added empty file, the resulting diff
    entry would include a download link, which then crashed with a
    PatchError. We've been getting these error emails a lot as bots have
    crawled our server.

    This change applies two fixes:

    • We no longer show a download link for new empty files.
    • If somehow the download endpoint is accessed anyway, we catch
      PatchError and return a 404.
    • Verified that newly-added empty files no longer contained a download
      link.
    • Ran unit tests.
    Summary ID
    Fix crashes when attempting to download newly-added empty files.
    When a diff contained a newly-added empty file, the resulting diff entry would include a download link, which then crashed with a `PatchError`. We've been getting these error emails a lot as bots have crawled our server. This change applies two fixes: - We no longer show a download link for new empty files. - If somehow the download endpoint is accessed anyway, we catch `PatchError` and return a 404. Testing Done: - Verified that newly-added empty files no longer contained a download link. - Ran unit tests.
    qsnylsomrlvksypomzxpuoxlmwkmptly
    Description From Last Updated

    Does the API need any changes for this?

    chipx86chipx86
    chipx86
    1. 
        
    2. Show all issues

      Does the API need any changes for this?

      1. The original file and patched file endpoints seem to be correctly defensive about everything.

    3. 
        
    maubin
    1. Ship It!
    2. 
        
    david
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-7.1.x (d0e8731)