File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -231,16 +231,22 @@ def is_pointer(cls, filepath):
231231 Return true if content of file at filepath looks like a valid digest
232232 identifier.
233233 """
234- with open (filepath , encoding = 'utf-8' ) as fh :
235- identifier = fh .read ()
236- # Remove possible trailing whitespace, newline and carriage return
237- # characters.
238- identifier = identifier .rstrip ()
234+ try :
235+ with open (filepath , encoding = 'utf-8' ) as fh :
236+ identifier = fh .read ()
237+ # Remove possible trailing whitespace, newline and carriage return
238+ # characters.
239+ identifier = identifier .rstrip ()
240+
241+ except UnicodeDecodeError :
242+ # Binary fileis cannot be decoded with UTF-8
243+ return False
239244
240245 # Check size corresponds to MD5 (32) or SHA3 256 (64).
241246 if len (identifier ) in (32 , 64 ):
242247 return all (byte in string .hexdigits for byte in identifier )
243248
249+ # If the identifier is not a valid Rift Annex pointer
244250 return False
245251
246252 def make_restore_cache (self ):
You can’t perform that action at this time.
0 commit comments