git style filename quoting controlled by core.quotePath
This is by no means complete, but escaping filenames in actionItemDesc does cover most commands. Note that for ActionItemBranchFilePath, the value is branch:file, and I choose to only quote the file part (if necessary). I considered quoting the whole thing. But, branch names cannot contain control characters, and while they can contain unicode, git coes not quote unicode when displaying branch names. So, it would be surprising for git-annex to quote unicode in a branch name. The find command is the most obvious command that still needs to be dealt with. There are probably other places that filenames also get displayed, eg embedded in error messages. Some other commands use ActionItemOther with a filename, I think that ActionItemOther should either be pre-sanitized, or should explicitly not be used for filenames, so that needs more work. When --json is used, unicode does not get escaped, but control characters were already escaped in json. (Key escaping may turn out to be needed, but I'm ignoring that for now.) Sponsored-by: unqueued on Patreon
This commit is contained in:
parent
81bc57322f
commit
d689a5b338
11 changed files with 78 additions and 45 deletions
|
@ -167,7 +167,8 @@ performRemote key afile backend numcopies remote =
|
|||
Nothing -> go True Nothing
|
||||
Just (Right verification) -> go True (Just (tmpfile, verification))
|
||||
Just (Left _) -> do
|
||||
warning (decodeBS (actionItemDesc ai) ++ ": failed to download file from remote")
|
||||
qp <- coreQuotePath <$> Annex.getGitConfig
|
||||
warning (decodeBS (actionItemDesc qp ai) ++ ": failed to download file from remote")
|
||||
void $ go True Nothing
|
||||
return False
|
||||
dispatch (Right False) = go False Nothing
|
||||
|
@ -350,9 +351,10 @@ verifyLocationLog' key ai present u updatestatus = do
|
|||
return True
|
||||
(False, True) -> do
|
||||
fix InfoMissing
|
||||
qp <- coreQuotePath <$> Annex.getGitConfig
|
||||
warning $
|
||||
"** Based on the location log, " ++
|
||||
decodeBS (actionItemDesc ai) ++
|
||||
decodeBS (actionItemDesc qp ai) ++
|
||||
"\n** was expected to be present, " ++
|
||||
"but its content is missing."
|
||||
return False
|
||||
|
@ -389,10 +391,11 @@ verifyRequiredContent key ai@(ActionItemAssociatedFile afile _) = case afile of
|
|||
if null missinglocs
|
||||
then return True
|
||||
else do
|
||||
qp <- coreQuotePath <$> Annex.getGitConfig
|
||||
missingrequired <- Remote.prettyPrintUUIDs "missingrequired" missinglocs
|
||||
warning $
|
||||
"** Required content " ++
|
||||
decodeBS (actionItemDesc ai) ++
|
||||
decodeBS (actionItemDesc qp ai) ++
|
||||
" is missing from these repositories:\n" ++
|
||||
missingrequired
|
||||
return False
|
||||
|
@ -465,8 +468,9 @@ checkKeySizeOr bad key file ai = case fromKey keySize key of
|
|||
return same
|
||||
badsize a b = do
|
||||
msg <- bad key
|
||||
qp <- coreQuotePath <$> Annex.getGitConfig
|
||||
warning $ concat
|
||||
[ decodeBS (actionItemDesc ai)
|
||||
[ decodeBS (actionItemDesc qp ai)
|
||||
, ": Bad file size ("
|
||||
, compareSizes storageUnits True a b
|
||||
, "); "
|
||||
|
@ -483,8 +487,9 @@ checkKeyUpgrade :: Backend -> Key -> ActionItem -> AssociatedFile -> Annex Bool
|
|||
checkKeyUpgrade backend key ai (AssociatedFile (Just file)) =
|
||||
case Types.Backend.canUpgradeKey backend of
|
||||
Just a | a key -> do
|
||||
qp <- coreQuotePath <$> Annex.getGitConfig
|
||||
warning $ concat
|
||||
[ decodeBS (actionItemDesc ai)
|
||||
[ decodeBS (actionItemDesc qp ai)
|
||||
, ": Can be upgraded to an improved key format. "
|
||||
, "You can do so by running: git annex migrate --backend="
|
||||
, decodeBS (formatKeyVariety (fromKey keyVariety key)) ++ " "
|
||||
|
@ -534,8 +539,9 @@ checkBackendOr bad backend key file ai =
|
|||
ok <- verifier key file
|
||||
unless ok $ do
|
||||
msg <- bad key
|
||||
qp <- coreQuotePath <$> Annex.getGitConfig
|
||||
warning $ concat
|
||||
[ decodeBS (actionItemDesc ai)
|
||||
[ decodeBS (actionItemDesc qp ai)
|
||||
, ": Bad file content; "
|
||||
, msg
|
||||
]
|
||||
|
@ -562,8 +568,9 @@ checkInodeCache key content mic ai = case mic of
|
|||
withTSDelta (liftIO . genInodeCache content) >>= \case
|
||||
Nothing -> noop
|
||||
Just ic' -> whenM (compareInodeCaches ic ic') $ do
|
||||
qp <- coreQuotePath <$> Annex.getGitConfig
|
||||
warning $ concat
|
||||
[ decodeBS (actionItemDesc ai)
|
||||
[ decodeBS (actionItemDesc qp ai)
|
||||
, ": Stale or missing inode cache; updating."
|
||||
]
|
||||
Database.Keys.addInodeCaches key [ic]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue