url size fixes
addurl: Improve message when adding url with wrong size to existing file. Before the message suggested the url didn't exist. Fixed handling of URL keys that have no recorded size. Before, if the key has no size, the url also had to not declare any size, which was unlikely and wrong, or it was taken to not exist. This probably would mostly affect keys that were added to the annex with addurl --relaxed.
This commit is contained in:
parent
5797364a07
commit
747f5b123c
5 changed files with 22 additions and 11 deletions
|
@ -124,14 +124,16 @@ perform relaxed url file = ifAnnexed file addurl geturl
|
|||
next $ return True
|
||||
| otherwise = do
|
||||
headers <- getHttpHeaders
|
||||
ifM (Url.withUserAgent $ Url.check url headers $ keySize key)
|
||||
( do
|
||||
(exists, samesize) <- Url.withUserAgent $ Url.check url headers $ keySize key
|
||||
if exists && samesize
|
||||
then do
|
||||
setUrlPresent key url
|
||||
next $ return True
|
||||
, do
|
||||
warning $ "failed to verify url exists: " ++ url
|
||||
else do
|
||||
warning $ if exists
|
||||
then "url does not have expected file size (use --relaxed to bypass this check) " ++ url
|
||||
else "failed to verify url exists: " ++ url
|
||||
stop
|
||||
)
|
||||
|
||||
addUrlFile :: Bool -> URLString -> FilePath -> Annex Bool
|
||||
addUrlFile relaxed url file = do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue