{"record":{"id":"2476b6f253e933b0","repo":"Tencent/WeKnora","slug":"invalid-minio-file-path-s","errorCode":null,"errorMessage":"invalid MinIO file path: %s","messagePattern":"invalid MinIO file path: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/service/file/minio.go","lineNumber":106,"sourceCode":"\treturn err\n}\n\n// CheckMinioConnectivity tests MinIO connectivity using the provided credentials.\n// It creates a temporary service instance internally and delegates to CheckConnectivity.\nfunc CheckMinioConnectivity(ctx context.Context, endpoint, accessKeyID, secretAccessKey, bucketName string, useSSL bool) error {\n\tsvc, err := newMinioClient(endpoint, accessKeyID, secretAccessKey, bucketName, useSSL)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn svc.CheckConnectivity(ctx)\n}\n\n// parseMinioFilePath extracts the object name from a provider scheme: minio://{bucket}/{objectKey}\nfunc (s *minioFileService) parseMinioFilePath(filePath string) (string, error) {\n\t// Provider scheme format: minio://{bucket}/{objectKey}\n\tconst prefix = \"minio://\"\n\tif !strings.HasPrefix(filePath, prefix) {\n\t\treturn \"\", fmt.Errorf(\"invalid MinIO file path: %s\", filePath)\n\t}\n\trest := strings.TrimPrefix(filePath, prefix)\n\tparts := strings.SplitN(rest, \"/\", 2)\n\tif len(parts) != 2 || parts[0] == \"\" || parts[1] == \"\" {\n\t\treturn \"\", fmt.Errorf(\"invalid MinIO file path: %s\", filePath)\n\t}\n\tif parts[0] != s.bucketName {\n\t\treturn \"\", fmt.Errorf(\"bucket mismatch in path: got %s, want %s\", parts[0], s.bucketName)\n\t}\n\tif err := utils.SafeObjectKey(parts[1]); err != nil {\n\t\treturn \"\", fmt.Errorf(\"invalid file path: %w\", err)\n\t}\n\treturn parts[1], nil\n}\n\n// SaveFile saves a file to MinIO\nfunc (s *minioFileService) SaveFile(ctx context.Context,\n\tfile *multipart.FileHeader, tenantID uint64, knowledgeID string,","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/service/file/minio.go#L88-L124","documentation":"MinIO path parser guard: the supplied file path does not start with the 'minio://' scheme (or is otherwise malformed), so no bucket/objectKey can be extracted and the operation is rejected before any storage call.","triggerScenarios":"Thrown at internal/application/service/file/minio.go:106 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass paths in the form minio://{bucket}/{objectKey}","Validate the scheme at the boundary that produced the path"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}