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

Simplify handling of long URLs in Util::linkOrButton #13817

Merged
merged 11 commits into from Nov 16, 2017

Conversation

Projects
None yet
1 participant
@nijel
Member

nijel commented Nov 16, 2017

We no longer create form, but rather rather tag the link to be handled
as POST on the client side.

This way the code is way simpler without need on any special case
handling on server side.

Fixes #13649

Signed-off-by: Michal Čihař michal@cihar.com

Before submitting pull request, please check that every commit:

  • Has proper Signed-Off-By
  • Has commit message which describes it
  • Is needed on it's own, if you have just minor fixes to previous commits, you can squash them
  • Any new functionality is covered by tests

@nijel nijel added this to the 4.8.0 milestone Nov 16, 2017

@codecov

This comment has been minimized.

Show comment
Hide comment
@codecov

codecov bot Nov 16, 2017

Codecov Report

Merging #13817 into master will increase coverage by 0.06%.
The diff coverage is 67.74%.

@@            Coverage Diff             @@
##           master   #13817      +/-   ##
==========================================
+ Coverage   53.41%   53.47%   +0.06%     
==========================================
  Files         491      491              
  Lines       81695    81580     -115     
==========================================
- Hits        43635    43628       -7     
+ Misses      38060    37952     -108

codecov bot commented Nov 16, 2017

Codecov Report

Merging #13817 into master will increase coverage by 0.06%.
The diff coverage is 67.74%.

@@            Coverage Diff             @@
##           master   #13817      +/-   ##
==========================================
+ Coverage   53.41%   53.47%   +0.06%     
==========================================
  Files         491      491              
  Lines       81695    81580     -115     
==========================================
- Hits        43635    43628       -7     
+ Misses      38060    37952     -108

nijel added some commits Nov 16, 2017

Simplify handling of long URLs in Util::linkOrButton
We no longer create form, but rather rather tag the link to be handled
as POST on the client side.

This way the code is way simpler without need on any special case
handling on server side.

Fixes #13649

Signed-off-by: Michal Čihař <michal@cihar.com>
Add tests for Util::linkOrButton
Signed-off-by: Michal Čihař <michal@cihar.com>
Remove no longer needed $new_form from Util::linkOrButton
Signed-off-by: Michal Čihař <michal@cihar.com>
Avoid using mb_* function for URL length calculation
It is handled in bytes on the webserver side, so use limits in bytes not
in chars as mb_strlen does.

Signed-off-by: Michal Čihař <michal@cihar.com>
Avoid double html encoding of link target
This is done when printing the attributes as well.

Signed-off-by: Michal Čihař <michal@cihar.com>
Always use POST for links containing SQL query
This way the SQL queries will not apper in the web server logs.

Signed-off-by: Michal Čihař <michal@cihar.com>
Document when POST is used in Util::linkOrButton
Signed-off-by: Michal Čihař <michal@cihar.com>
Remove magic to add message in Util::linkOrButton
The passed parameter should be already valid, we should avoid expensive
processing of the data such as calling strip_tags on every text
containing <img.

Signed-off-by: Michal Čihař <michal@cihar.com>
Remove not needed $force_button paratemet from Util::linkOrButton
It was used to force POST for few links with the SQL, but that
is now done automatically.

Signed-off-by: Michal Čihař <michal@cihar.com>
Avoid passing default params to Util::linkOrButton
Do not pass optional parameters with default values.

Signed-off-by: Michal Čihař <michal@cihar.com>
Remove $strip_img parameter from Util::linkOrButton
It did not behave as documented for ages, it only influenced
whether additional text was added to the link.

Callers should use parameters to Util::getIcon to achieve this
(if it is actually needed somewhere)

Signed-off-by: Michal Čihař <michal@cihar.com>

@nijel nijel self-assigned this Nov 16, 2017

@nijel nijel merged commit 152c485 into phpmyadmin:master Nov 16, 2017

6 checks passed

DCO All commits have a DCO sign-off from the author
Scrutinizer Analysis: 3 new issues, 6 updated code elements – Tests: passed
Details
codacy/pr Good work! A positive pull request.
Details
codecov/patch 67.74% of diff hit (target 53.41%)
Details
codecov/project 53.47% (+0.06%) compared to efe62c9
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@nijel nijel deleted the nijel:link-or-button branch Nov 16, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment