2
0
Fork
You've already forked cms
0

Codeberg storage adapter fails to create files in the right location and fails to save over files #68

Closed
opened 2026年01月10日 11:48:29 +01:00 by 5310 · 2 comments
5310 commented 2026年01月10日 11:48:29 +01:00 (Migrated from github.com)
Copy link

The Codeberg storage adapter can read files from the repo once the path is clearly defined, but fails to save to those files, throwing: Error: Forgejo API request failed: 500 Internal Server Error

I think this issue might be related to the other and perhaps even stranger problem that happens at the same time:

  1. If I try to save a completely new path that doesn't yet exist in my repo the file does get created, but always under a completely unrelated content directory, with the intended path kept in the filename with slashes escaped with %2F!
  2. And yet, the adapter can read existing files on the correct path only if I set the path to src folder correctly to src, but still tries to save to content/src%2F...
  3. But when it tries to save a doc to an existing file (all under content for now) it throws error 500

As an example, contained in this repo snapshot:

  1. This repo has a src/index.yaml file that the CMS can read when I set the storage adapter to Scio/goyenda-club/src
  2. And yet, when it saves the file, it does so to content/%252Findex.yaml for the first attempt.
    1. But for subsequent attempts, simply fails with error 500
  3. The other two files under content were created by changing the document path for testing, please ignore them

I only just discovered the Codeberg storage adapter this morning. And I know that the docs don't mention its existence, so it might not be ready for use. But I couldn't help but create this issue because the adapter module itself is deployed on the CDNs.

The Codeberg storage adapter can read files from the repo once the path is clearly defined, but fails to save to those files, throwing: `Error: Forgejo API request failed: 500 Internal Server Error` I think this issue might be related to the other and perhaps even stranger problem that happens at the same time: 1. If I try to save a completely new path that doesn't yet exist in my repo the file _does_ get created, but _always_ under a completely unrelated `content` directory, with the intended path kept in the filename with slashes escaped with `%2F`! 2. And yet, the adapter can _read_ existing files on the correct path only if I set the path to src folder correctly to `src`, but still tries to save to `content/src%2F...` 3. But when it tries to save a doc to an existing file (all under `content` for now) it throws error 500 --- As an example, contained in this [repo snapshot](https://codeberg.org/Scio/goyenda-club/src/commit/ca57e3e3760012c143d75f7ee65038509bf5ebfb): 1. This repo has a `src/index.yaml` file that the CMS can read when I set the storage adapter to `Scio/goyenda-club/src` 2. And yet, when it saves the file, it does so to `content/%252Findex.yaml` for the first attempt. 1. But for subsequent attempts, simply fails with error 500 3. The other two files under `content` were created by changing the document path for testing, please ignore them --- I only just discovered the Codeberg storage adapter this morning. And I know that the [docs](https://lume.land/cms/configuration/storage/) don't mention its existence, so it might not be ready for use. But I couldn't help but create this issue because the adapter module itself is deployed on the CDNs.

Yeah, I knew this error and that's why it's not mentioned yet in the docs because I didn't know why it failed.
But your comment gave me some clues and I figured out that the bug was a stupid thing. I just fixed it.

I've also made some changes in the Lume implementation to fix issues related with additional storages. Now you can overwrite the "src" storage, making it easy to switch from filesystem to a remote storage. For example:

const token = Deno.env.get("CODEBERG_TOKEN");
// overwrite "src"
if (token) {
 cms.storage("src", Codeberg.create("Scio/goyenda-club/src", token);
}

To test this, you have to upgrade Lume and LumeCMS to the latest development version (deno task lume upgrade --dev).
Let me know if you find any issue. Thanks!

Yeah, I knew this error and that's why it's not mentioned yet in the docs because I didn't know why it failed. But your comment gave me some clues and I figured out that the bug was a stupid thing. I [just fixed it](https://github.com/lumeland/cms/commit/fe1ecced177bb3e31cf2d6065d1201f7e38370cf). I've also made some changes in the Lume implementation to fix issues related with additional storages. Now you can overwrite the "src" storage, making it easy to switch from filesystem to a remote storage. For example: ```js const token = Deno.env.get("CODEBERG_TOKEN"); // overwrite "src" if (token) { cms.storage("src", Codeberg.create("Scio/goyenda-club/src", token); } ``` To test this, you have to upgrade Lume and LumeCMS to the latest development version (`deno task lume upgrade --dev`). Let me know if you find any issue. Thanks!
5310 commented 2026年01月11日 10:49:07 +01:00 (Migrated from github.com)
Copy link

Working flawlessly! Thanks a lot for the multiple quick fixes. Creation edition and deletion, it all works now! Including more easily overriding the storage 🥳

Working flawlessly! Thanks a lot for the _multiple_ quick fixes. Creation edition and deletion, it all works now! Including more easily overriding the storage 🥳
Sign in to join this conversation.
No Branch/Tag specified
main
lumecms/outra-versión
lumecms/proba-2
v0.15.7
v0.15.6
v0.15.5
v0.15.4
v0.15.3
v0.15.2
v0.15.1
v0.15.0
v0.14.16
v0.14.15
v0.14.14
v0.14.13
v0.14.12
v0.14.11
v0.14.10
v0.14.9
v0.14.8
v0.14.7
v0.14.6
v0.14.5
v0.14.4
v0.14.3
v0.14.2
v0.14.1
v0.14.0
v0.13.0
v0.13.0-beta.1
v0.13.0-beta.0
v0.12.5
v0.12.4
v0.12.3
v0.12.2
v0.12.1
v0.12.0
v0.11.5
v0.11.4
v0.11.3
v0.11.2
v0.11.1
v0.11.0
v0.10.5
v0.10.4
v0.10.3
v0.10.2
v0.10.1
v0.10.0
v0.9.4
v0.9.3
v0.9.2
v0.9.1
v0.9.0
v0.8.3
v0.8.2
v0.8.1
v0.8.0
v0.7.7
v0.7.6
v0.7.5
v0.7.4
v0.7.3
v0.7.2
v0.7.1
v0.7.0
v0.6.8
v0.6.7
v0.6.6
v0.6.5
v0.6.4
v0.6.3
v0.6.2
v0.6.1
v0.6.0
v0.5.10
v0.5.9
v0.5.8
v0.5.7
v0.5.6
v0.5.5
v0.5.4
v0.5.3
v0.5.2
v0.5.1
v0.5.0
v0.4.3
v0.4.2
v0.4.1
v0.4.0
v0.3.12
v0.3.11
v0.3.10
v0.3.9
v0.3.8
v0.3.7
v0.3.6
v0.3.5
v0.3.4
v0.3.3
v0.3.2
v0.3.1
v0.3.0
v0.2.11
v0.2.10
v0.2.9
v0.2.8
v0.2.7
v0.2.6
v0.2.5
v0.2.4
v0.2.3
v0.2.2
v0.2.1
v0.2.0
v0.1.0
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lume/cms#68
Reference in a new issue
lume/cms
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?