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 non-utf8 when found in uploaded RPMs. #1028

Merged
merged 1 commit into from
Feb 24, 2017
Merged

Fix non-utf8 when found in uploaded RPMs. #1028

merged 1 commit into from
Feb 24, 2017

Conversation

jortel
Copy link
Contributor

@jortel jortel commented Feb 22, 2017

https://pulp.plan.io/issues/1903

Seemed to make more sense to decode entire primary XML fragment instead of doing it element-by-element. This approach is simpler and more comprehensive.

@mention-bot
Copy link

@jortel, thanks for your PR! By analyzing the history of the files in this pull request, we identified @ipanova, @mhrivnak and @BrnoPCmaniak to be potential reviewers.

@@ -44,7 +44,9 @@ def get_package_xml(pkg_path, sumtype=util.TYPE_SHA256):
return {}
# RHEL6 createrepo throws a ValueError if _cachedir is not set
po._cachedir = None
primary_xml_snippet = change_location_tag(po.xml_dump_primary_metadata(), pkg_path)
primary_xml_snippet = po.xml_dump_primary_metadata()
primary_xml_snippet = primary_xml_snippet.decode('utf-8', 'replace')
Copy link
Contributor

Choose a reason for hiding this comment

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

I notice that you moved this to be sooner in the workflow than where string_to_unicode was being called. What's the reasoning for that?

Copy link
Contributor

Choose a reason for hiding this comment

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

Never mind, I read your comment on the PR which explains this.

end_portion = string_to_unicode(primary_xml_snippet[end_index:])
location = string_to_unicode("""<location href="%s"/>""" % (
file_utils.make_packages_relative_path(relpath)))
first_portion = primary_xml_snippet[:start_index]
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the doc block above needs to be changed to reflect that it takes unicode in and returns unicode back.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

makes sense.

@@ -44,7 +44,9 @@ def get_package_xml(pkg_path, sumtype=util.TYPE_SHA256):
return {}
# RHEL6 createrepo throws a ValueError if _cachedir is not set
po._cachedir = None
primary_xml_snippet = change_location_tag(po.xml_dump_primary_metadata(), pkg_path)
primary_xml_snippet = po.xml_dump_primary_metadata()
primary_xml_snippet = primary_xml_snippet.decode('utf-8', 'replace')
Copy link
Contributor

Choose a reason for hiding this comment

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

Never mind, I read your comment on the PR which explains this.

<checksum type="sha256" pkgid="YES">b88a43acd5c9239</checksum>
<summary>rabbit IDE</summary>
<description>The rabbit (professional) IDE.</description>
<packager>Frosty \u2603\x9a</packager>
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice.

@jortel jortel removed the question label Feb 24, 2017
@jortel jortel merged commit 2818e3e into pulp:2.12-dev Feb 24, 2017
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.

None yet

3 participants