Fix edge-case bug path prefix check for watch & bind mounts

Signed-off-by: Matiboux <matiboux@gmail.com>
This commit is contained in:
Matiboux 2025-03-15 00:30:37 +01:00 committed by Nicolas De loof
parent f38f3f754c
commit 9129abe516
4 changed files with 10 additions and 2 deletions

View File

@ -353,8 +353,11 @@ func loadDevelopmentConfig(service types.ServiceConfig, project *types.Project)
func checkIfPathAlreadyBindMounted(watchPath string, volumes []types.ServiceVolumeConfig) bool {
for _, volume := range volumes {
if volume.Bind != nil && strings.HasPrefix(watchPath, volume.Source) {
return true
if volume.Bind != nil {
relPath, err := filepath.Rel(volume.Source, watchPath)
if err == nil && !strings.HasPrefix(relPath, "..") {
return true
}
}
}
return false

View File

@ -37,4 +37,7 @@ services:
RUN mkdir -p /app/config
init: true
command: sleep infinity
volumes:
- ./dat:/app/dat
- ./data-logs:/app/data-logs
develop: *x-dev

View File

@ -0,0 +1 @@
i am a wannabe cat

View File

@ -0,0 +1 @@
[INFO] Server started successfully on port 8080