Super-productivity: GitHub search fails when typing issue number prefixed with #

Created on 10 Sep 2020  路  3Comments  路  Source: johannesjo/super-productivity

Your Environment

  • Version used: 5.7.0 deb
  • Operating System and version: Debian testing
  • Desktop Environment: GNOME

Expected Behavior

When using the issue suggestions from GitHub feature and typing #123 in the new issue box, I expect that it autocompletes issue #123 just like GitHub does. When typing Test # or Test & I expect it to show issues from my repository that contain Test.

Current Behavior

An error message "GitHub: Validation failed" is displayed. This is apparently because the input from the input box is send to GitHub without proper sanitizing. Thus, everything behind the # ends up in the fragment part of the URL and thus the search string is empty when starting with #. Furthermore if one types Test # or Test &, issues from all repositories containing the phrase "Test" are shown, as the repository restriction is moved to the fragment part or outside the q parameter.

Steps to Reproduce (for bugs)

  1. Create a project
  2. Configure GitHub integration and enable suggestions
  3. Type #123 in the new task input box
  4. Or, Type Test # in the new task input box

Mitigations

Properly encode search input before putting it in the URL. Solution is probably to use encodeURIComponent instead of encodeURI. I noticed that spaces and many other special chars are encoded correctly.

enhancement good first issue hacktoberfest help wanted

Most helpful comment

That's encodeURI which does not correctly encode &, #, + and = as it would be needed here. encodeURIComponent should do the job.

All 3 comments

Thanks for opening this up. Actually the search string should already be encoded:
https://github.com/johannesjo/super-productivity/blob/2465e099458526de49ca90d9849462e1262631fe/src/app/features/issue/providers/github/github-api.service.ts#L56

I try to look into it as soon as I can.

That's encodeURI which does not correctly encode &, #, + and = as it would be needed here. encodeURIComponent should do the job.

I was NOT aware of the difference! Thanks for letting me know! :) Would you like to provide a PR yourself? Should be very straightforward then.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

theCalcaholic picture theCalcaholic  路  3Comments

IT-Tool picture IT-Tool  路  3Comments

sdruskat picture sdruskat  路  3Comments

alexanderadam picture alexanderadam  路  3Comments

Mindstormer619 picture Mindstormer619  路  4Comments