Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tc-copy cannot import name 'imap' #669

Closed
wants to merge 2 commits into from

Conversation

sandypm007
Copy link
Contributor

@sandypm007 sandypm007 commented Dec 30, 2020

Fix #220

Comment on lines +38 to +44
if tile.content_type:
if tile.content_type.startswith("image/"):
tile.data = response.content
else:
tile.error = response.text
elif response.status_code != 200:
tile.error = "Unable to read content type {0}".format(title.content_type)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why you do this change? Shouldn't just be:

Suggested change
if tile.content_type:
if tile.content_type.startswith("image/"):
tile.data = response.content
else:
tile.error = response.text
elif response.status_code != 200:
tile.error = "Unable to read content type {0}".format(title.content_type)
if tile.content_type and tile.content_type.startswith("image/"):
tile.data = response.content
else:
tile.error = response.text

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes the response has content but not content type header set so it continues failing, i tested it using openstreetmap

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you an example of URL that didn't returns a content-type?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just merge the first part, and for this I do an alternative as #673, does it look good?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't i it be better coding three commands, Ill make it up

@sbrunner sbrunner changed the title Fix #220 Fix tc-copy cannot import name 'imap' Dec 30, 2020
@sbrunner
Copy link
Member

Fixed with #673

@sbrunner sbrunner closed this Jan 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tc-copy cannot import name 'imap'
3 participants