Attachments not found after update #12475

Closed
opened 2025-11-02 10:11:00 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @BernardFaure on GitHub (Feb 12, 2024).

Description

Hello, I'm using Gitea server, self hosted, on Linux Ubuntu 20.04.6
After updating from 1.19.3 to 1.21.5, Gitea is not able to find the old attachments (from issue, or version, or whatever) that was created before the update

The message in the log file is :
...b/repo/attachment.go:147:ServeAttachment() [E] Open: open /var/lib/gitea/data/data/attachments/9/1/914f0341-80ee-4154-ad13-5a053df5ac6d: no such file or directory
It appears that the requested file is in fact in the directory "/var/lib/gitea/data/attachments/9/1/"
It seems that the new version of Gitea has added a "data" directory in the "/var/lib/gitea/data" directory

Log gist :

2024/02/12 16:32:20 ...b/repo/attachment.go:147:ServeAttachment() [E] Open: open /var/lib/gitea/data/data/attachments/b/8/b8869f36-7357-43ef-925a-5207737a6565: no such file or directory
2024/02/12 16:32:20 ...eb/routing/logger.go:102:func1() [I] router: completed GET /Owner/repository/releases/download/v4.7.289/build.properties for 192.168.10.41:0, 500 Internal Server Error in 24.8ms @ repo/repo.go:373(repo.RedirectDownload)

Gitea Version

1.21.5

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

git version 2.25.1

Operating System

Linux Ubuntu 20.04.6

How are you running Gitea?

Self hosted, using Go

Database

MySQL/MariaDB

Originally created by @BernardFaure on GitHub (Feb 12, 2024). ### Description Hello, I'm using Gitea server, self hosted, on Linux Ubuntu 20.04.6 After updating from 1.19.3 to 1.21.5, Gitea is not able to find the old attachments (from issue, or version, or whatever) that was created before the update The message in the log file is : ` ...b/repo/attachment.go:147:ServeAttachment() [E] Open: open /var/lib/gitea/data/data/attachments/9/1/914f0341-80ee-4154-ad13-5a053df5ac6d: no such file or directory ` It appears that the requested file is in fact in the directory "/var/lib/gitea/data/attachments/9/1/" It seems that the new version of Gitea has added a "data" directory in the "/var/lib/gitea/data" directory Log gist : ``` 2024/02/12 16:32:20 ...b/repo/attachment.go:147:ServeAttachment() [E] Open: open /var/lib/gitea/data/data/attachments/b/8/b8869f36-7357-43ef-925a-5207737a6565: no such file or directory 2024/02/12 16:32:20 ...eb/routing/logger.go:102:func1() [I] router: completed GET /Owner/repository/releases/download/v4.7.289/build.properties for 192.168.10.41:0, 500 Internal Server Error in 24.8ms @ repo/repo.go:373(repo.RedirectDownload) ``` ### Gitea Version 1.21.5 ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version git version 2.25.1 ### Operating System Linux Ubuntu 20.04.6 ### How are you running Gitea? Self hosted, using Go ### Database MySQL/MariaDB
GiteaMirror added the issue/needs-feedback label 2025-11-02 10:11:00 -06:00
Author
Owner

@wxiaoguang commented on GitHub (Feb 12, 2024):

It seems that there was some incorrect path configuration in your old instance.

The most suspicious one is the "work-path" (env GITEA_WORK_DIR). Almost other directories are relative to it.

So, maybe you could try to manually set the WORK_PATH=/var/lib/gitea in your app.ini, or fix/use absolute paths for your storage paths, or move the files.

@wxiaoguang commented on GitHub (Feb 12, 2024): It seems that there was some incorrect path configuration in your old instance. The most suspicious one is the "work-path" (env GITEA_WORK_DIR). Almost other directories are relative to it. So, maybe you could try to manually set the `WORK_PATH=/var/lib/gitea` in your app.ini, or fix/use absolute paths for your storage paths, or move the files.
Author
Owner

@BernardFaure commented on GitHub (Feb 12, 2024):

Well, thanks a lot !
you gave me a correct clue : the [attachment] "PATH" in my app.ini file was "data/attachment".
I suppose that this path was ok in the previous versions.

Defining "PATH=attachment" fixed the problem

Thank you very much

Bernard

@BernardFaure commented on GitHub (Feb 12, 2024): Well, thanks a lot ! you gave me a correct clue : the [attachment] "PATH" in my app.ini file was "data/attachment". I suppose that this path was ok in the previous versions. Defining "PATH=attachment" fixed the problem Thank you very much Bernard
Author
Owner

@github-actions[bot] commented on GitHub (Feb 28, 2024):

Automatically locked because of our CONTRIBUTING guidelines

@github-actions[bot] commented on GitHub (Feb 28, 2024): Automatically locked because of our [CONTRIBUTING guidelines](https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md#issue-locking)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#12475