Skip to content

Commit

Permalink
fix windows upload file
Browse files Browse the repository at this point in the history
  • Loading branch information
zuiwuchang committed Jan 25, 2024
1 parent 78dfeef commit e8fc224
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions slave/server/fs/srv.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"net/http"
"os"
"path/filepath"
"strings"
"time"

"github.com/powerpuffpenguin/webpc/db"
Expand Down Expand Up @@ -603,6 +604,9 @@ func (s server) Upload(ctx context.Context, req *grpc_fs.UploadRequest) (resp *g
if e != nil {
return
}
for strings.HasPrefix(req.Path, `//`) {
req.Path = req.Path[1:]
}
resp, e = upload.Upload(m, req)
TAG := `forward.fs Upload`
if e == nil {
Expand Down
11 changes: 11 additions & 0 deletions view/src/app/forward-fs/dialog/upload/uploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ class Task {
return completer.promise
}
get path(): string {
if (this.dir.dir.endsWith("/")) {
return this.dir.dir + this.file.file.name
}
return this.dir.dir + '/' + this.file.file.name
}
private async _init(): Promise<Array<string>> {
Expand Down Expand Up @@ -306,6 +309,14 @@ class Task {
private async _put(i: number, chunk: Chunk) {
const dir = this.dir
const buffer = await chunk.arrayBuffer()

console.log("upload", {
id: dir.id,
root: dir.root,
i: i,
path: this.path,
})
console.log(dir)
await ServerAPI.forward.v1.fs.child('upload', dir.id, dir.root, i, this.path).post(this.httpClient, buffer).pipe(
takeUntil(this.closed_.observable)
).toPromise()
Expand Down

0 comments on commit e8fc224

Please sign in to comment.