resource: Use the correct Destination FS
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 1 Jan 2018 13:28:19 +0000 (14:28 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 1 Jan 2018 13:28:19 +0000 (14:28 +0100)
Source and destination will be the same when this happens, but it should be correct.

See #4202

resource/image.go

index 2e8dc5f02ed80ac565dcf71fa002eca3269cb5ae..c638a995e0c09396ec8dffb455d9323c44adb28d 100644 (file)
@@ -414,7 +414,7 @@ func (i *Image) copyToDestination(src string) error {
                if err != nil && os.IsNotExist(err) {
                        // When called from shortcodes, the target directory may not exist yet.
                        // See https://github.com/gohugoio/hugo/issues/4202
-                       if err = i.spec.Fs.Source.MkdirAll(filepath.Dir(target), os.FileMode(0755)); err != nil {
+                       if err = i.spec.Fs.Destination.MkdirAll(filepath.Dir(target), os.FileMode(0755)); err != nil {
                                res = err
                                return
                        }