diff options
Diffstat (limited to 'internal/notify/service.go')
| -rw-r--r-- | internal/notify/service.go | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/internal/notify/service.go b/internal/notify/service.go index 22d7830..d46293f 100644 --- a/internal/notify/service.go +++ b/internal/notify/service.go @@ -13,6 +13,8 @@ package notify import ( "log" + "os" + "strings" "sync" "time" @@ -45,10 +47,22 @@ func NewService(conn *dbus.Conn, dir string) *Service { if err := Publish(s.dir, live, history); err != nil { log.Printf("notifyd: publish: %v", err) } - }) + }, s.removeImage) return s } +// removeImage unlinks only what the daemon wrote, so a client's own image-path +// is never touched. +func (s *Service) removeImage(path string) { + if path == "" { + return + } + if !strings.HasPrefix(path, ImagesDir(s.dir)+string(os.PathSeparator)) { + return + } + os.Remove(path) +} + // Start exports the interfaces and empties the state. Nothing from a previous // run is resurrected. func (s *Service) Start() error { |
