[PR #568] [CLOSED] fix: remove leading slash from path after TrimPrefix in GCS storage #589

Closed
opened 2026-02-16 01:16:25 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langgenius/dify-plugin-daemon/pull/568
Author: @minodisk
Created: 1/14/2026
Status: Closed

Base: mainHead: fix/gcs-storage-path-parsing


📝 Commits (1)

  • 98c15f6 fix: remove leading slash from path after TrimPrefix in GCS storage

📊 Changes

1 file changed (+4 additions, -2 deletions)

View changed files

📝 internal/core/plugin_manager/media_transport/installed_bucket.go (+4 -2)

📄 Description

Summary

When using GCS storage, the List() method in installed_bucket.go returns paths like plugins/org/plugin:1.0@hash. After TrimPrefix("plugins"), the result is /org/plugin:1.0@hash with a leading slash, which causes PluginUniqueIdentifier validation to fail.

This fix adds an additional TrimPrefix("/") to remove the leading slash.

Error Log

plugin_unique_identifier is not valid: /org/plugin:0.0.1@c6091c925eb5180de7a0ce0c94aea7329e7b3f7ed390f5e5a7a5d2991b85fc72

Root Cause

In installed_bucket.go:78, when GCS storage returns a path like:

  • path.Path = "plugins/org/plugin:0.0.1@hash"
  • b.installedPath = "plugins"

The strings.TrimPrefix(path.Path, b.installedPath) produces:

  • /org/plugin:0.0.1@hash (note the leading slash)

This leading slash causes the identifier validation to fail.

Changes

  • Added strings.TrimPrefix(..., "/") to remove the leading slash after removing the installed path prefix

Related issue: https://github.com/langgenius/dify/issues/22741


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langgenius/dify-plugin-daemon/pull/568 **Author:** [@minodisk](https://github.com/minodisk) **Created:** 1/14/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/gcs-storage-path-parsing` --- ### 📝 Commits (1) - [`98c15f6`](https://github.com/langgenius/dify-plugin-daemon/commit/98c15f6194a9fa0e12ffb73d94eac8bb0d0c25a5) fix: remove leading slash from path after TrimPrefix in GCS storage ### 📊 Changes **1 file changed** (+4 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `internal/core/plugin_manager/media_transport/installed_bucket.go` (+4 -2) </details> ### 📄 Description ## Summary When using GCS storage, the `List()` method in `installed_bucket.go` returns paths like `plugins/org/plugin:1.0@hash`. After `TrimPrefix("plugins")`, the result is `/org/plugin:1.0@hash` with a leading slash, which causes `PluginUniqueIdentifier` validation to fail. This fix adds an additional `TrimPrefix("/")` to remove the leading slash. ## Error Log ``` plugin_unique_identifier is not valid: /org/plugin:0.0.1@c6091c925eb5180de7a0ce0c94aea7329e7b3f7ed390f5e5a7a5d2991b85fc72 ``` ## Root Cause In `installed_bucket.go:78`, when GCS storage returns a path like: - `path.Path = "plugins/org/plugin:0.0.1@hash"` - `b.installedPath = "plugins"` The `strings.TrimPrefix(path.Path, b.installedPath)` produces: - `/org/plugin:0.0.1@hash` (note the leading slash) This leading slash causes the identifier validation to fail. ## Changes - Added `strings.TrimPrefix(..., "/")` to remove the leading slash after removing the installed path prefix Related issue: https://github.com/langgenius/dify/issues/22741 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 01:16:25 -05:00
yindo closed this issue 2026-02-16 01:16:25 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-plugin-daemon#589