coze-dev / coze-dev/coze-loop

[BUG] Object storage upload keys use backslashes on Windows

Open Beginner friendly
#629 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
5.7k
Forks
795
Avg merge
1d 4h
Merged PRs (30d)
29

Description

### 📋 CheckList

- [x] I have searched existing issues to avoid duplicates
- [x] I am using a recently maintained version of Coze Loop
- [x] I have provided all required information
- [x] I understand this is a bug report and not a feature request
- [x] I have submitted this report in English (otherwise it will not be processed)

### 🐛 Bug Description

`UploadLoopFile` and `UploadFileForServer` construct object-storage keys with `filepath.Join`. On Windows, this produces backslash-separated keys, even though object-storage keys and the existing test contract use forward slashes.

### 🔄 Steps to Reproduce

1. Check out current `main` on Windows.
2. Run:

```shell
cd backend
go test -count=1 -run 'TestFileServiceImpl_Upload(LoopFile|FileForServer)$' -v ./modules/foundation/domain/file/service
```

3. Observe failures in both upload methods because generated keys contain backslashes.

### ✅ Expected Behavior

Object-storage keys are platform-independent, for example `1234567890/testfile.txt` and `workspace/custom.txt`.

### ❌ Actual Behavior

On Windows, the keys are generated as `1234567890\testfile.txt` and `workspace\custom.txt`. Prefix-only uploads similarly fail the existing `space/` expectation.

### 🚨 Severity

Medium - Minor functionality affected

### 🔧 Component

Infrastructure

### 💻 Environment

- OS: Windows 11
- Go: go1.26.3 windows/amd64
- Coze Loop: `a2c804de6f95a209a1bd6cb6489c5a76221abd20` (current `main` when reproduced)

### 🔧 Go Environment

Relevant values: `GOOS=windows`, `GOARCH=amd64`, `GOVERSION=go1.26.3`.

### 📋 Logs

```text
expected: "1234567890/testfile.txt"
actual : "1234567890\\testfile.txt"

expected: "workspace/custom.txt"
actual : "workspace\\custom.txt"
```

### 📝 Additional Context

The storage-key path should use the slash-oriented `path` package rather than the OS-filesystem-oriented `path/filepath` package. The existing tests already encode the expected portable key format.

Contributor guide

Open the contributing guide

Research direction

Start in backend/modules/foundation/domain/file/service and run the provided Windows-focused Go test command for TestFileServiceImpl_UploadLoopFile and TestFileServiceImpl_UploadFileForServer. Trace how those methods construct object-storage keys, then verify the tests pass with platform-independent forward-slash keys, including the prefix-only space/ expectation.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, cloud
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
86/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.