From 537f0ae5db3061798e6467ef9e5ee31f73ea9e9e Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Fri, 8 Dec 2023 17:20:49 +0400 Subject: [PATCH] OCI storage: unconditionally remove the old link when link()'ing (#686) --- Sources/tart/VMStorageOCI.swift | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Sources/tart/VMStorageOCI.swift b/Sources/tart/VMStorageOCI.swift index ec20a07..a2e5831 100644 --- a/Sources/tart/VMStorageOCI.swift +++ b/Sources/tart/VMStorageOCI.swift @@ -219,9 +219,7 @@ class VMStorageOCI: PrunableStorage { } func link(from: RemoteName, to: RemoteName) throws { - if FileManager.default.fileExists(atPath: vmURL(from).path) { - try FileManager.default.removeItem(at: vmURL(from)) - } + try? FileManager.default.removeItem(at: vmURL(from)) try FileManager.default.createSymbolicLink(at: vmURL(from), withDestinationURL: vmURL(to))