diff --git a/src/caoscrawler/crawl.py b/src/caoscrawler/crawl.py index 0883ca8fc529d477966083ff158557f396e1c22c..201b01edcef16f9656b4ca1ad174e55e8ff8d947 100644 --- a/src/caoscrawler/crawl.py +++ b/src/caoscrawler/crawl.py @@ -740,6 +740,17 @@ class Crawler(object): else: # side effect record.id = identified_record.id + # Special treatment for name and description in case + # they have been set in the server independently from + # the crawler + for attr in ["name", "description"]: + if getattr(record, attr) is None: + # The crawler didn't find any name or + # description, i.e., not an empty one. In this + # case (and only in this), keep any existing + # name or description. + setattr(record, attr, getattr( + identified_record, attr)) # Copy over checksum and size too if it is a file if isinstance(record, db.File): record._size = identified_record._size