Commit f0616b69 authored by Thibault Saunier's avatar Thibault Saunier Committed by Daniel Stone
Browse files

phabtogl: Ignore attachment import errors

One might not have permission on certain file, or other issue might
happen and it should not fail the process.

The following issue happened import Pitivi:

```
phabricator.APIError: ERR-CONDUIT-CORE: [Access Denied:
Restricted File] (Can View) You do not have permission
to view this object. // thiblahute (Thibault Saunier)
can take this action. The user who uploaded a file can
always view and edit it. Files attached to objects are
visible to users who can view those objects. Thumbnails
are visible only to users who can view the original file.
```
parent 08a7fbf9
......@@ -229,8 +229,12 @@ class Phab:
for filelink in re.findall(Phab.FILES_REGEX, markdown):
fileid = filelink.strip("{F").strip("}")
markdown = markdown.replace(
filelink, self.migrate_attachment(fileid))
try:
markdown = markdown.replace(
filelink, self.migrate_attachment(fileid))
except phabricator.APIError:
print("WARNING: Could not migrate file: %s" % filelink)
pass
# Prevent spurious links to other GitLab issues
markdown = re.sub(r'([Cc]omment) #([0-9]+)', '\\1 \\2', markdown)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment