Error downloading release files after upgrade to 1.20.3 (HTTP code 500) #11582

Closed
opened 2025-11-02 09:41:41 -06:00 by GiteaMirror · 12 comments
Owner

Originally created by @mppha on GitHub (Sep 1, 2023).

Originally assigned to: @CaiCandong on GitHub.

Description

After upgrading 1.19.0 -> 1.20.3, the following error is shown when trying to download a release file:

An error occurred:

Open, open /var/lib/gitea/data/data/attachments/7/3/73bcfcc3-ab3c-42b3-9980-6f1e99312034: no such file or directory

Looking at the startup logs it seems that the attachments path is different despite using the same configuration.
Before upgrade:

...s/storage/storage.go:175:initAttachments() [I] Initialising Attachment storage with type:
 ...les/storage/local.go:45:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/data/attachments

After upgrade:

...s/storage/storage.go:176:initAttachments() [I] Initialising Attachment storage with type: local
...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/data/data/attachments

Gitea Version

1.20.3

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Prebuilt binary (https://dl.gitea.com/gitea/1.20.3/gitea-1.20.3-linux-amd64) on RHEL8.8 with systemd.
Service file based on https://github.com/go-gitea/gitea/blob/main/contrib/systemd/gitea.service

Database

None

Originally created by @mppha on GitHub (Sep 1, 2023). Originally assigned to: @CaiCandong on GitHub. ### Description After upgrading 1.19.0 -> 1.20.3, the following error is shown when trying to download a release file: ``` An error occurred: Open, open /var/lib/gitea/data/data/attachments/7/3/73bcfcc3-ab3c-42b3-9980-6f1e99312034: no such file or directory ``` Looking at the startup logs it seems that the attachments path is different despite using the same configuration. Before upgrade: ``` ...s/storage/storage.go:175:initAttachments() [I] Initialising Attachment storage with type: ...les/storage/local.go:45:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/data/attachments ``` After upgrade: ``` ...s/storage/storage.go:176:initAttachments() [I] Initialising Attachment storage with type: local ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/data/data/attachments ``` ### Gitea Version 1.20.3 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? Prebuilt binary (https://dl.gitea.com/gitea/1.20.3/gitea-1.20.3-linux-amd64) on RHEL8.8 with systemd. Service file based on https://github.com/go-gitea/gitea/blob/main/contrib/systemd/gitea.service ### Database None
GiteaMirror added the type/question label 2025-11-02 09:41:41 -06:00
Author
Owner

@CaiCandong commented on GitHub (Sep 1, 2023):

Could you post the configuration information for the [attachment] section of your app.ini?

@CaiCandong commented on GitHub (Sep 1, 2023): Could you post the configuration information for the `[attachment]` section of your `app.ini`?
Author
Owner

@mppha commented on GitHub (Sep 1, 2023):

Thanks for the quick response @CaiCandong

[attachment]
ENABLE = true
PATH = data/attachments
MAX_SIZE = 100
MAX_FILES = 5
@mppha commented on GitHub (Sep 1, 2023): Thanks for the quick response @CaiCandong ``` [attachment] ENABLE = true PATH = data/attachments MAX_SIZE = 100 MAX_FILES = 5 ```
Author
Owner

@CaiCandong commented on GitHub (Sep 1, 2023):

Thanks. I can also see locally that there seems to be an extra /data here.
image

@CaiCandong commented on GitHub (Sep 1, 2023): Thanks. I can also see locally that there seems to be an extra `/data` here. ![image](https://github.com/go-gitea/gitea/assets/50507092/13bfc4a3-d78a-4389-a9d2-c8cbd4ade677)
Author
Owner

@techknowlogick commented on GitHub (Sep 1, 2023):

PATH = data/attachments. Thanks for posting your config, could you update the PATH to be an absolute path definition (/var/lib/gitea/data/attachments)?

@techknowlogick commented on GitHub (Sep 1, 2023): `PATH = data/attachments`. Thanks for posting your config, could you update the `PATH` to be an absolute path definition (`/var/lib/gitea/data/attachments`)?
Author
Owner

@CaiCandong commented on GitHub (Sep 1, 2023):

PATH = data/attachments. Thanks for posting your config, could you update the PATH to be an absolute path definition (/var/lib/gitea/data/attachments)?

I think this is a bug , if I don't set this field:
image
image

The default value here is not data/attachments?

@CaiCandong commented on GitHub (Sep 1, 2023): > `PATH = data/attachments`. Thanks for posting your config, could you update the `PATH` to be an absolute path definition (`/var/lib/gitea/data/attachments`)? I think this is a bug , if I don't set this field: ![image](https://github.com/go-gitea/gitea/assets/50507092/75b04064-c74a-449f-8a9b-22fe0200b673) ![image](https://github.com/go-gitea/gitea/assets/50507092/efbf9a7b-76be-45ec-a424-adafe62c0dd5) The default value here is not `data/attachments`?
Author
Owner

@mppha commented on GitHub (Sep 1, 2023):

@techknowlogick Changing to absolute path seems to fix the variable as seen in startup logs:

...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/data/attachments

Older release files can now be downloaded, but newer releases fail (these seem to be stored in /var/lib/gitea/data/data):

An error occurred:

Open, open /var/lib/gitea/data/attachments/a/1/a1325050-c807-4c8c-8a8f-9ad6c18ab8c3: no such file or directory
@mppha commented on GitHub (Sep 1, 2023): @techknowlogick Changing to absolute path seems to fix the variable as seen in startup logs: ``` ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/data/attachments ``` Older release files can now be downloaded, but newer releases fail (these seem to be stored in `/var/lib/gitea/data/data`): ``` An error occurred: Open, open /var/lib/gitea/data/attachments/a/1/a1325050-c807-4c8c-8a8f-9ad6c18ab8c3: no such file or directory ```
Author
Owner

@CaiCandong commented on GitHub (Sep 1, 2023):

You can move over manually first, which will allow your service to be available. I'm still locating this bug. @mppha

@CaiCandong commented on GitHub (Sep 1, 2023): You can move over manually first, which will allow your service to be available. I'm still locating this bug. @mppha
Author
Owner

@mppha commented on GitHub (Sep 1, 2023):

fyi, all our releases are now available after setting the config to PATH = /var/lib/gitea/data/attachments and moving all newer releases manually from /var/lib/gitea/data/data/attachments to /var/lib/gitea/data/attachments

@mppha commented on GitHub (Sep 1, 2023): fyi, all our releases are now available after setting the config to `PATH = /var/lib/gitea/data/attachments` and moving all newer releases manually from `/var/lib/gitea/data/data/attachments` to `/var/lib/gitea/data/attachments`
Author
Owner

@techknowlogick commented on GitHub (Sep 1, 2023):

@mppha glad to hear.
I'll keep this open while @CaiCandong does additional investigation and creates a bugfix

@techknowlogick commented on GitHub (Sep 1, 2023): @mppha glad to hear. I'll keep this open while @CaiCandong does additional investigation and creates a bugfix
Author
Owner

@CaiCandong commented on GitHub (Sep 1, 2023):

I'll keep this open while @CaiCandong does additional investigation and creates a bugfix

I asked @Lunny about this, and he said that the path is relative to the AppDataPath, so maybe we should update the config docs and app.example.ini
The default configuration should be PATH=attachments (${AppDataPath}/${attachments.PATH} )
I haven't tested to see if in 1.19.0 whether the ${AppWorkPath}/${attachments.PATH}

@CaiCandong commented on GitHub (Sep 1, 2023): > I'll keep this open while @CaiCandong does additional investigation and creates a bugfix I asked @Lunny about this, and he said that the path is relative to the AppDataPath, so maybe we should update the config docs and `app.example.ini` The default configuration should be `PATH=attachments` (`${AppDataPath}/${attachments.PATH}` ) I haven't tested to see if in 1.19.0 whether the `${AppWorkPath}/${attachments.PATH}`
Author
Owner

@CaiCandong commented on GitHub (Sep 2, 2023):

This change was caused by #26271. Although I do not understand the code about it now, it is clear that it does that to fix a bug. But it is breaking change.
For configuration as below:

[attachment]
ENABLE = true
PATH = data/attachments
MAX_SIZE = 100
MAX_FILES = 5
  • Before #26271, the resolved path is ${AppWorkPath}/${attachments.PATH} (/var/lib/gitea/data/attachments)
  • After #26271, the resolved path is ${AppDataPath}/${attachments.PATH} (/var/lib/gitea/data/data/attachments)
@CaiCandong commented on GitHub (Sep 2, 2023): This change was caused by #26271. Although I do not understand the code about it now, it is clear that it does that to fix a bug. But it is breaking change. For configuration as below: ``` [attachment] ENABLE = true PATH = data/attachments MAX_SIZE = 100 MAX_FILES = 5 ``` - Before #26271, the resolved path is `${AppWorkPath}/${attachments.PATH}` (`/var/lib/gitea/data/attachments`) - After #26271, the resolved path is `${AppDataPath}/${attachments.PATH}` (`/var/lib/gitea/data/data/attachments`)
Author
Owner

@lunny commented on GitHub (Sep 3, 2023):

I'll keep this open while @CaiCandong does additional investigation and creates a bugfix

I asked @lunny about this, and he said that the path is relative to the AppDataPath, so maybe we should update the config docs and app.example.ini The default configuration should be PATH=attachments (${AppDataPath}/${attachments.PATH} ) I haven't tested to see if in 1.19.0 whether the ${AppWorkPath}/${attachments.PATH}

Yes, this was a break change.

@lunny commented on GitHub (Sep 3, 2023): > > I'll keep this open while @CaiCandong does additional investigation and creates a bugfix > > I asked @lunny about this, and he said that the path is relative to the AppDataPath, so maybe we should update the config docs and `app.example.ini` The default configuration should be `PATH=attachments` (`${AppDataPath}/${attachments.PATH}` ) I haven't tested to see if in 1.19.0 whether the `${AppWorkPath}/${attachments.PATH}` Yes, this was a break change.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#11582