Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

OS-specific path separator problem #22

Closed
xiongjiwei opened this issue Aug 22, 2021 · 5 comments
Closed

OS-specific path separator problem #22

xiongjiwei opened this issue Aug 22, 2021 · 5 comments

Comments

@xiongjiwei
Copy link

go-service-ftp/utils.go

Lines 139 to 142 in f5d7dba

// Join will clean the trailng "/", we need to append it back.
if strings.HasSuffix(path, string(filepath.Separator)) {
absPath += string(filepath.Separator)
}

filepath.Separator is an OS-specific path separator, on windows, it is \, on UNIX it is /. it will cause the path problem, if some write a file on windows, the path may look like \path/to/file, and the read it on UNIX, the path is \path\to\file, I do not know it is the server or client responsibility, should the server handle this two style path or client provide the correct path according to the syst command?

@xiongjiwei
Copy link
Author

also, it here should be

if !strings.HasSuffix(path, string(filepath.Separator)) { 
 	absPath += string(filepath.Separator) 
}

@Xuanwo
Copy link
Contributor

Xuanwo commented Aug 22, 2021

It's a wide problem exists in all our services. Our original design requires user input UNIX style path. But it proved to be impossible. We will start a new GSP in which we will make the path handle logic clear.

@Xuanwo
Copy link
Contributor

Xuanwo commented Aug 22, 2021

This issue should be resolved by beyondstorage/go-storage#649

@Xuanwo
Copy link
Contributor

Xuanwo commented Sep 18, 2021

We are working on resolving this issue via new GSP: beyondstorage/go-storage#749

@Xuanwo
Copy link
Contributor

Xuanwo commented Oct 19, 2021

Already fixed in GSP-749: beyondstorage/go-storage#749

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants