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

cylc review: URL encode links #3125

Merged
merged 2 commits into from
Apr 30, 2019
Merged

cylc review: URL encode links #3125

merged 2 commits into from
Apr 30, 2019

Conversation

kinow
Copy link
Member

@kinow kinow commented Apr 25, 2019

Close #3121

Close #3119

Use Jinja2's urlencode filter instead of replacing characters individually. Tested with Cylc suites "cylc1" and "%63ylc1". Links working as below.

image

image

EDIT: added another close #3119 as it appears to fix both issues 👍

@kinow kinow added this to the next-release milestone Apr 25, 2019
@kinow kinow self-assigned this Apr 25, 2019
@kinow
Copy link
Member Author

kinow commented Apr 25, 2019

Appears to fix the issue for #3121. Added to next release, but we can push to 7.8.3 if it's better. Tried to fix it as I found the bug and it was included for 7.8.x series 👍

@kinow kinow changed the title URL encode links cylc review: URL encode links Apr 25, 2019
@kinow
Copy link
Member Author

kinow commented Apr 25, 2019

Added @sadielbartholomew as one of the reviewers as she should be aware of what was the issue about. Happy to anyone else step in as second reviewer 👍

@kinow
Copy link
Member Author

kinow commented Apr 25, 2019

But looks like I will have to edit this PR to include a fix for slashes, as Jinja2 developers decided against escaping the slash. Which caused issues in Ansible and other tools. One example was automatic generated passwords with slash that were not correctly escaped 😞

pallets/jinja#515

Will include a fix for the slash in a few minutes.

@hjoliver
Copy link
Member

Good for 7.8.2. If @sadielbartholomew can review by early next week (we need to get the release out by May 1, I think.

@kinow
Copy link
Member Author

kinow commented Apr 25, 2019

No problem, otherwise I think it would just go to 7.8.3 or maybe postponed to Cylc 8 (not sure how common are suites with these special characters)

@kinow
Copy link
Member Author

kinow commented Apr 25, 2019

Manual tests passed for me.

@sadielbartholomew added another commit with more changes. It may require further time to test, so feel free to push to after 7.8.2 (i.e. remove next-release milestone, set to 7.8.3 or later I think).

I registered suites with names such as:

  • %63ylc1
  • cylc1 (same as above if %63 is url-decoded)
  • %63ylc2 (i.e. if url-decoded by accident anywhere, there would be no cylc2 and a 404 would raise)
  • "''.abc.def240"
  • broadcast1
  • broad&63ast1

And I used two suite.rc files only (meaning many suites shared the same source). The broadcast suites I used to test the broadcast links were using the suite.rc from Cylc's example suite "etc/examples/task-states/". It is a good suite as it also fails a few times, shows retries, different icons, links, etc.

And the other suite I quickly wrote to have a task with some special characters too, which required adding urlencode when showing links with the task name as well:

# file: suite.rc
[scheduling]
[[dependencies]]
graph = "a+b%c%63"

[runtime]
[[a]]
script = "true"

Hope that helps testing and reproducing the issues.

Cheers
Bruno

@sadielbartholomew
Copy link
Collaborator

Good for 7.8.2. If @sadielbartholomew can review by early next week (we need to get the release out by May 1, I think.

Sorry @kinow, I have been very busy with user support, but I'm reviewing this now. Thanks for your patience.

Copy link
Collaborator

@sadielbartholomew sadielbartholomew left a comment

Choose a reason for hiding this comment

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

Well spotted for these bugs! FYI, I have now got clarification on the task & suite names we consider valid (which does include the % character), & I will shortly amend the scope of my PR #3117 to:

  • make this explicit in the documentation;
  • make validate consistent, to report agreed (in)valid names as (in)valid;
  • ensure the set of all valid names function properly, with respect to:
    • suite (runtime) behaviour;
    • Cylc Review.

@kinow
Copy link
Member Author

kinow commented Apr 30, 2019

Thanks Sadie! Happy to close this one if #3117 will supersede it.

Copy link
Member

@hjoliver hjoliver left a comment

Choose a reason for hiding this comment

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

LGTM

@hjoliver
Copy link
Member

Thanks Sadie! Happy to close this one if #3117 will supersede it.

I'm interpreting @sadielbartholomew's approval of this PR literally! Merging...

@hjoliver hjoliver merged commit 1bc712b into cylc:7.8.x Apr 30, 2019
@kinow
Copy link
Member Author

kinow commented May 1, 2019

Oh, I hadn't seen her approval, only the comment (replied around 5AM after the fire alarm sounded in my building until near 6AM 😴 )

@hjoliver
Copy link
Member

hjoliver commented May 1, 2019

Damn, that sucks!

@sadielbartholomew
Copy link
Collaborator

Thanks Sadie! Happy to close this one if #3117 will supersede it.

Yes, sorry for any lack of clarity, I should have been explicit that the extended #3117 would build on top of the good work completed for this PR. As Hilary rightly guessed, I wanted this merged ASAP 🏁

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