Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[backport]: handle multiple consecutive slashes in the path string. #2045

Open
wants to merge 7 commits into
base: 2.1
Choose a base branch
from

Conversation

quzard
Copy link
Collaborator

@quzard quzard commented Jan 16, 2025

问题描述:
当用户在 Kubernetes 配置中使用以多个斜杠开头的挂载路径时(如 //test/log),会导致 formateContainerPath 获取到的挂载路径与采集配置中的 idf.LogPath 路径(/test/log)不匹配,从而引发数组越界问题。

image

例如以下挂载配置:

volumeMounts:
- mountPath: //test/log/
  name: volume-123123 
  subPath: test

采集路径为/test/log/**/*.log

修复方案:
优化 formatPath 函数,确保当路径以斜杠开头时,只保留一个斜杠,使路径格式符合标准规范。

@quzard quzard changed the title handle multiple consecutive slashes in the path string. [backport]: handle multiple consecutive slashes in the path string. Jan 16, 2025
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