mirror of
https://github.com/docker/compose.git
synced 2025-04-08 17:05:13 +02:00
Fix edge-case bug path prefix check for watch & bind mounts
Signed-off-by: Matiboux <matiboux@gmail.com>
This commit is contained in:
parent
f38f3f754c
commit
9129abe516
@ -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
|
||||
|
@ -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
|
||||
|
1
pkg/e2e/fixtures/watch/dat/meow.dat
Normal file
1
pkg/e2e/fixtures/watch/dat/meow.dat
Normal file
@ -0,0 +1 @@
|
||||
i am a wannabe cat
|
1
pkg/e2e/fixtures/watch/data-logs/server.log
Normal file
1
pkg/e2e/fixtures/watch/data-logs/server.log
Normal file
@ -0,0 +1 @@
|
||||
[INFO] Server started successfully on port 8080
|
Loading…
x
Reference in New Issue
Block a user