Skip to content

fix path(contains : ) invalid on windows - #697

Merged
wonderflow merged 3 commits into
qiniu:masterfrom
xxh2000:fix_path_err
Aug 8, 2018
Merged

wonderflow merged 3 commits into
qiniu:masterfrom
xxh2000:fix_path_err

Conversation

@xxh2000

@xxh2000 xxh2000 commented Aug 7, 2018

Copy link
Copy Markdown
Contributor

Fixes [issue number]

Changes

  • fix path error bug

Comment thread reader/tailx/tailx.go Outdated

func NewActiveReader(originPath, realPath, whence string, meta *reader.Meta, msgChan chan<- Result, errChan chan<- error) (ar *ActiveReader, err error) {
rpath := strings.Replace(realPath, string(os.PathSeparator), "_", -1)
rpath = strings.Replace(rpath,":","_",-1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这样修会导致linux用户的meta出现不兼容的情况,升级会出现错误

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

linux环境一般路径没有冒号吧

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if os.GOOS == "windows"{
   rpath = strings.Replace(rpath,":","_",-1)
}

这样合理些

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

嗯,这样严谨一点

@wonderflow

Copy link
Copy Markdown
Contributor

fixes #500

@wonderflow
wonderflow merged commit 120ad62 into qiniu:master Aug 8, 2018
@xxh2000
xxh2000 deleted the fix_path_err branch August 27, 2018 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

⌂ 换网址