feat: add unit tests for COS object name parsing and enhance error handling
This commit introduces unit tests for the `parseCosObjectName` method in the `cosFileService`, ensuring it correctly rejects local scheme URLs and properly parses COS scheme URLs. Additionally, the `parseCosObjectName` method has been updated to return an error for unsupported schemes, improving error handling in the `GetFile` and `DeleteFile` methods. This enhancement ensures more robust handling of file paths in the application.
This commit is contained in:
@@ -9,7 +9,6 @@ import (
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"github.com/redis/go-redis/v9"
|
||||
)
|
||||
|
||||
@@ -44,9 +43,8 @@ type qaRequest struct {
|
||||
channel *IMChannel
|
||||
channelID string
|
||||
|
||||
// fileSvc resolves storage URLs to HTTP URLs for the tenant's storage backend.
|
||||
// May be nil if the tenant has no storage config.
|
||||
fileSvc interfaces.FileService
|
||||
// tenant is used to resolve provider:// URLs in outbound replies (scheme-aware).
|
||||
tenant *types.Tenant
|
||||
|
||||
// userKey is "channelID:userID:chatID", used for per-user limits and /stop.
|
||||
userKey string
|
||||
|
||||
Reference in New Issue
Block a user