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.
This commit is contained in:
Joey Hess 2018-02-22 13:20:19 -04:00
parent a944549db9
commit cb3b73df6c
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 5 additions and 1 deletions

View file

@ -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

View file

@ -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