@@ -169,7 +169,7 @@ func (storage *PublishedStorage) LinkFromPool(publishedPrefix, publishedRelPath,
169169
170170 var dstStat os.FileInfo
171171
172- dstStat , err = os .Stat (filepath . Join ( poolPath , baseName ) )
172+ dstStat , err = os .Stat (destinationPath )
173173 if err == nil {
174174 // already exists, check source file
175175
@@ -188,7 +188,7 @@ func (storage *PublishedStorage) LinkFromPool(publishedPrefix, publishedRelPath,
188188 } else {
189189 // if source and destination have the same checksums, no need to copy
190190 var dstMD5 string
191- dstMD5 , err = utils .MD5ChecksumForFile (filepath . Join ( poolPath , baseName ) )
191+ dstMD5 , err = utils .MD5ChecksumForFile (destinationPath )
192192
193193 if err != nil {
194194 return err
@@ -219,11 +219,11 @@ func (storage *PublishedStorage) LinkFromPool(publishedPrefix, publishedRelPath,
219219
220220 // source and destination have different inodes, if !forced, this is fatal error
221221 if ! force {
222- return fmt .Errorf ("error linking file to %s: file already exists and is different" , filepath . Join ( poolPath , baseName ) )
222+ return fmt .Errorf ("error linking file to %s: file already exists and is different" , destinationPath )
223223 }
224224
225225 // forced, so remove destination
226- err = os .Remove (filepath . Join ( poolPath , baseName ) )
226+ err = os .Remove (destinationPath )
227227 if err != nil {
228228 return err
229229 }
@@ -238,7 +238,7 @@ func (storage *PublishedStorage) LinkFromPool(publishedPrefix, publishedRelPath,
238238 }
239239
240240 var dst * os.File
241- dst , err = os .Create (filepath . Join ( poolPath , baseName ) )
241+ dst , err = os .Create (destinationPath )
242242 if err != nil {
243243 _ = r .Close ()
244244 return err
@@ -266,9 +266,9 @@ func (storage *PublishedStorage) LinkFromPool(publishedPrefix, publishedRelPath,
266266
267267 err = dst .Close ()
268268 } else if storage .linkMethod == LinkMethodSymLink {
269- err = localSourcePool .Symlink (sourcePath , filepath . Join ( poolPath , baseName ) )
269+ err = localSourcePool .Symlink (sourcePath , destinationPath )
270270 } else {
271- err = localSourcePool .Link (sourcePath , filepath . Join ( poolPath , baseName ) )
271+ err = localSourcePool .Link (sourcePath , destinationPath )
272272 }
273273
274274 return err
0 commit comments