aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2018-02-22 13:20:19 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2018-02-22 13:20:19 -0400
commitd00da705b994c792af284d9b2dbb8e01ae8d705e (patch)
treeb5ef4aa3ac31ed8d0770f9b63a0545b2c2a4b047
parent044842dc64f7adaf0cfe30ea807bc4f8cd3e424d (diff)
importfeed: Fix a failure when downloading with youtube-dl and the destination subdirectory does not exist yet.
Noticed while running this (which a user posted in a comment they deleted for some reason): git-annex importfeed https://vimeo.com/logiingimars/videos/rss The filename that youtube-dl suggests included a subdirectory, which didn't exist, so renaming to it failed. This commit was sponsored by mo on Patreon.
-rw-r--r--CHANGELOG2
-rw-r--r--Command/AddUrl.hs4
2 files changed, 5 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 737ffc4a5..c03db1f93 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -24,6 +24,8 @@ git-annex (6.20180113) UNRELEASED; urgency=medium
the json output.
* Remove temporary code added in 6.20160619 to prime the mergedrefs
log.
+ * importfeed: Fix a failure when downloading with youtube-dl
+ and the destination subdirectory does not exist yet.
-- Joey Hess <id@joeyh.name> Wed, 24 Jan 2018 20:42:55 -0400
diff --git a/Command/AddUrl.hs b/Command/AddUrl.hs
index dfdbf5b5a..0e7201f12 100644
--- a/Command/AddUrl.hs
+++ b/Command/AddUrl.hs
@@ -370,7 +370,9 @@ addWorkTree u url file key mtmp = case mtmp of
Nothing -> go
Just tmp -> do
-- Move to final location for large file check.
- pruneTmpWorkDirBefore tmp (\_ -> liftIO $ renameFile tmp file)
+ pruneTmpWorkDirBefore tmp $ \_ -> liftIO $ do
+ createDirectoryIfMissing True (takeDirectory file)
+ renameFile tmp file
largematcher <- largeFilesMatcher
large <- checkFileMatcher largematcher file
if large