importfeed --relaxed: Avoid hitting the urls of items in the feed.
This commit is contained in:
parent
f30a7ccc42
commit
0f5d6c09ac
7 changed files with 16 additions and 4 deletions
|
@ -138,8 +138,10 @@ probeCrippledFileSystem = do
|
||||||
createSymbolicLink f f2
|
createSymbolicLink f f2
|
||||||
nukeFile f2
|
nukeFile f2
|
||||||
preventWrite f
|
preventWrite f
|
||||||
-- Should be unable to write to the file, but some crippled
|
-- Should be unable to write to the file, unless
|
||||||
|
-- running as root, but some crippled
|
||||||
-- filesystems ignore write bit removals.
|
-- filesystems ignore write bit removals.
|
||||||
|
unlessM
|
||||||
not <$> catchBoolIO (writeFile f "2" >> return True)
|
not <$> catchBoolIO (writeFile f "2" >> return True)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -182,7 +182,7 @@ startWeb o s = go $ fromMaybe bad $ parseURI urlstring
|
||||||
regulardownload url = do
|
regulardownload url = do
|
||||||
pathmax <- liftIO $ fileNameLengthLimit "."
|
pathmax <- liftIO $ fileNameLengthLimit "."
|
||||||
urlinfo <- if relaxedOption o
|
urlinfo <- if relaxedOption o
|
||||||
then pure $ Url.UrlInfo True Nothing Nothing
|
then pure Url.assumeUrlExists
|
||||||
else Url.withUrlOptions (Url.getUrlInfo urlstring)
|
else Url.withUrlOptions (Url.getUrlInfo urlstring)
|
||||||
file <- adjustFile o <$> case fileOption o of
|
file <- adjustFile o <$> case fileOption o of
|
||||||
Just f -> pure f
|
Just f -> pure f
|
||||||
|
|
|
@ -172,7 +172,9 @@ performDownload opts cache todownload = case location todownload of
|
||||||
r <- Remote.claimingUrl url
|
r <- Remote.claimingUrl url
|
||||||
if Remote.uuid r == webUUID || rawOption opts
|
if Remote.uuid r == webUUID || rawOption opts
|
||||||
then do
|
then do
|
||||||
urlinfo <- Url.withUrlOptions (Url.getUrlInfo url)
|
urlinfo <- if relaxedOption opts
|
||||||
|
then pure Url.assumeUrlExists
|
||||||
|
else Url.withUrlOptions (Url.getUrlInfo url)
|
||||||
maybeToList <$> addUrlFile (relaxedOption opts) url urlinfo f
|
maybeToList <$> addUrlFile (relaxedOption opts) url urlinfo f
|
||||||
else do
|
else do
|
||||||
res <- tryNonAsync $ maybe
|
res <- tryNonAsync $ maybe
|
||||||
|
|
|
@ -20,6 +20,7 @@ module Utility.Url (
|
||||||
exists,
|
exists,
|
||||||
UrlInfo(..),
|
UrlInfo(..),
|
||||||
getUrlInfo,
|
getUrlInfo,
|
||||||
|
assumeUrlExists,
|
||||||
download,
|
download,
|
||||||
downloadQuiet,
|
downloadQuiet,
|
||||||
parseURIRelaxed
|
parseURIRelaxed
|
||||||
|
@ -104,6 +105,9 @@ data UrlInfo = UrlInfo
|
||||||
, urlSuggestedFile :: Maybe FilePath
|
, urlSuggestedFile :: Maybe FilePath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assumeUrlExists :: UrlInfo
|
||||||
|
assumeUrlExists = UrlInfo True Nothing Nothing
|
||||||
|
|
||||||
{- Checks that an url exists and could be successfully downloaded,
|
{- Checks that an url exists and could be successfully downloaded,
|
||||||
- also returning its size and suggested filename if available. -}
|
- also returning its size and suggested filename if available. -}
|
||||||
getUrlInfo :: URLString -> UrlOptions -> IO UrlInfo
|
getUrlInfo :: URLString -> UrlOptions -> IO UrlInfo
|
||||||
|
|
1
debian/changelog
vendored
1
debian/changelog
vendored
|
@ -13,6 +13,7 @@ git-annex (5.20150813) UNRELEASED; urgency=medium
|
||||||
http.
|
http.
|
||||||
* Avoid building the assistant on the hurd, since an inotify equivilant
|
* Avoid building the assistant on the hurd, since an inotify equivilant
|
||||||
is not yet implemented in git-annex for the hurd.
|
is not yet implemented in git-annex for the hurd.
|
||||||
|
* importfeed --relaxed: Avoid hitting the urls of items in the feed.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Wed, 12 Aug 2015 14:31:01 -0400
|
-- Joey Hess <id@joeyh.name> Wed, 12 Aug 2015 14:31:01 -0400
|
||||||
|
|
||||||
|
|
|
@ -34,3 +34,5 @@ I ran into this bug trying to importfeed various BBC podcasts. For instance:
|
||||||
### What version of git-annex are you using? On what operating system?
|
### What version of git-annex are you using? On what operating system?
|
||||||
|
|
||||||
git-annex version: 5.20150731-1 on a quite up-to-date debian unstable.
|
git-annex version: 5.20150731-1 on a quite up-to-date debian unstable.
|
||||||
|
|
||||||
|
> Thanks for a nice test case. [[fixed|done]] --[[Joey]]
|
||||||
|
|
|
@ -25,7 +25,8 @@ be used to get better filenames.
|
||||||
|
|
||||||
* `--fast`
|
* `--fast`
|
||||||
|
|
||||||
Avoid immediately downloading the url.
|
Avoid immediately downloading the url. The url is still checked
|
||||||
|
(via HEAD) to verify that it exists, and to get its size if possible.
|
||||||
|
|
||||||
* `--relaxed`
|
* `--relaxed`
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue