|
|
@@ -75,7 +75,11 @@ class DirectoryStorage(Storage): |
|
|
|
|
|
|
|
def search_metadata(self, criteria): |
|
|
|
_logger.info(f'Searching metadata by criteria: {criteria!r}') |
|
|
|
for metadataFilename in glob.glob('*.codearchiver-metadata', root_dir = self._directory): |
|
|
|
# Replace this with `root_dir` when dropping Python 3.9 support |
|
|
|
escapedDirPrefix = os.path.join(glob.escape(self._directory), '') |
|
|
|
escapedDirPrefixLen = len(escapedDirPrefix) |
|
|
|
for metadataFilename in glob.glob(f'{escapedDirPrefix}*.codearchiver-metadata'): |
|
|
|
metadataFilename = metadataFilename[escapedDirPrefixLen:] |
|
|
|
_logger.info(f'Searching metadata {metadataFilename}') |
|
|
|
with self.open(metadataFilename, 'r') as fp: |
|
|
|
idx = codearchiver.core.Metadata.deserialise(fp, validate = False) |
|
|
|