Skip to content

Fix for static path parsing - #1396

Merged
dcadams merged 1 commit into
masterfrom
dcadams/fix_static_paths
Oct 25, 2013
Merged

Fix for static path parsing#1396
dcadams merged 1 commit into
masterfrom
dcadams/fix_static_paths

Conversation

@dcadams

@dcadams dcadams commented Oct 18, 2013

Copy link
Copy Markdown
Contributor

When a url contains a query parameter it gets incorrectly parsed
when replacing the /static portion.

This fix introduces a special case for urls with query parameters.

Fix for JIRA issue: LMS-1377

@dcadams

dcadams commented Oct 18, 2013

Copy link
Copy Markdown
Contributor Author

@cdodge This is the issue we discussed in email the other day where a url with query params gets mangled. Would you mind taking a look please.

@dcadams

dcadams commented Oct 18, 2013

Copy link
Copy Markdown
Contributor Author

Note that although the PR is pointing to a failed test, it isn't for this PR. It seems someone stole my hash :)

Anyway, the correct test run for this PR is at https://jenkins.testeng.edx.org/job/edx-all-tests-manual-commit/18/

@wedaly is aware of the issue.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would it be possible to put this 'query string parameter aware-ness' inside the .convert_legacy_static_url_with_course_id rather than the replace_static_url? It seems generic enough to be useful other places.

@chrisndodge

Copy link
Copy Markdown
Contributor

Thanks for the bug fix submission.

@dcadams

dcadams commented Oct 21, 2013

Copy link
Copy Markdown
Contributor Author

@chrisndodge moved the code per your suggestion. Thanks.

@dcadams

dcadams commented Oct 23, 2013

Copy link
Copy Markdown
Contributor Author

@chrisndodge Is this good to go?

@chrisndodge

Copy link
Copy Markdown
Contributor

@dcadams sorry for the radio silence - been heads down on some work. Looking again...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I haven't used urlparse before, but is there another way to reference the params element besides the [4] index. It's not very readable. Can you do urlparse(path).params instead?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Short answer: yes, you can.

@dcadams

dcadams commented Oct 25, 2013

Copy link
Copy Markdown
Contributor Author

@chrisndodge @cpennington Thank you for the comments. Please take another look.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think you need the two cases, now. Couldn't you just take the loc_url, and then urljoin the rest of url_parse (minus the path) onto it? Then, if query is empty, it should work the same as the old code, and if query isn't empty, it'll do the right thing.

When a url contains a query parameter it gets incorrectly parsed
when replacing the /static portion.

This fix handles urls with query parameters.
@dcadams

dcadams commented Oct 25, 2013

Copy link
Copy Markdown
Contributor Author

@cpennington good idea. Would you mind taking another look.

@cpennington

Copy link
Copy Markdown
Contributor

👍

dcadams pushed a commit that referenced this pull request Oct 25, 2013
@dcadams
dcadams merged commit 5fbda0c into master Oct 25, 2013
@dcadams
dcadams deleted the dcadams/fix_static_paths branch October 25, 2013 21:55
jenkins-ks pushed a commit to nttks/edx-platform that referenced this pull request Nov 27, 2016
* Implements ga_optional openedx#1239 (openedx#1393)

* Fix has_terminated on course-overview. openedx#1324 (openedx#1391)

* Version up CourseOverview to regenerate CourseOverview.

* Add send_mail option to ContractAuth(biz) openedx#1322 (openedx#1392)

* Revert "Revert "Merge pull request openedx#1298 from hachiyanagi-ks/develop/dogwood/…" (openedx#1394)

* Version up django and ora2 openedx#1375 (openedx#1396)

* Version up to django==1.8.16 openedx#1375

* Version up ora2 to gacco/eucalyptus==1.1.5 openedx#1375

* Add format file openedx#1428 (openedx#1465)

* Text correction of scoring by instructor openedx#1467
jamestait pushed a commit to open-craft/openedx-platform that referenced this pull request Mar 4, 2019
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.

3 participants