Closed nswarup14 closed 5 years ago
I've reviewed the patch. I can see the removal of download_uri
, and the change from ignore
to download
, which makes sense. But I don't understand what the other changes are for, and the commit message didn't explain. (Please make sure the explanation and justification for changes is in the commit message, because that's what will end up in the git log
, which is used by other developers through git bisect
or git blame
long after GitHub pull requests may have been archived.) I did re-read your pull request opening comment, but still didn't understand what the other changes are for.
@quozl Thanks I will update the commit message as well.
I refactored the code which saved the metadata of the browse-activity in a journal instance. The state of a regular tab was a bytes
object, which needs to be decoded and the state of a PDF tab was a regular dictionary. Hence I was handled both the cases in separate if-else
cases.
I realize the other changes are not required after reading the documentation once again. I shall remove them immediately.
Fixes #54
Changes 1)
browser.py
2)pdfviewer.py
Updates At the present master HEAD (https://github.com/sugarlabs/browse-activity/commit/540c93fa5fe4ca1a741c6460abed2607aa8a8078), if the
mime_type
, in__decide_policy_cb
isapplication/pdf
, a newGET
request was being issued after setting up the PDF tab inpdfviewer.py/_download_from_http
, where thecontext.download_uri(remote_uri)
was the culprit.Rather than make a new
GET
request, I used the response obtained from the firstGET
request to download the PDF directly, using theWebKit2.PolicyDecision.download()
. The function also emits thedownload-started
signal which is connected topdfviewer.py/__download_started_cb
, which handles the rest.I found a thread in the WebKit2 mailing list (here), that seems to explain the issue in more detail.
@quozl @pro-panda Please let me know if I have approached this issue in the right step.
Thanks.
Tested on Ubuntu 18.04, Sugar v0.114