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

Creating a project from a URL: URLs with leading whitespace are rejected #2516

Open
wetneb opened this issue Apr 4, 2020 · 6 comments
Open

Creating a project from a URL: URLs with leading whitespace are rejected #2516

wetneb opened this issue Apr 4, 2020 · 6 comments

Comments

@wetneb
Copy link
Member

@wetneb wetneb commented Apr 4, 2020

Describe the bug

The input field to create a project from a URL does not trim its input when validating it.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Create Project' -> 'Web Addresses (URL)'
  2. Paste " http://api.worldbank.org/countries/all/indicators/SP.POP.TOTL?date=2000:2001" with the leading whitespace
  3. Validate
  4. The URL is rejected

Expected behavior

The value of this input should be trimmed before validation.

OpenRefine (please complete the following information):

  • master branch (3.4 snapshot)
@Nishtha3512
Copy link

@Nishtha3512 Nishtha3512 commented Apr 4, 2020

Screenshot from 2020-04-04 14-36-17
Hey,Where is the option to validate?
As you can see in above screenshot when i click on create project then project is simply created without rejecting any URL.

@wetneb
Copy link
Member Author

@wetneb wetneb commented Apr 4, 2020

Are you sure you included whitespace before the URL?
image

@Nishtha3512
Copy link

@Nishtha3512 Nishtha3512 commented Apr 4, 2020

Ohh now i understand your issue.Can you please tell me where is code related to issue?I will try to fix it.
Is it in OpenRefine/main/src/com/google/refine/importers/XmlImporter.java file?

@wetneb
Copy link
Member Author

@wetneb wetneb commented Apr 4, 2020

No, it is a UI issue, so it is in a Javascript file.

Here is how you can find it:

  • Search for the error message "You must specify a valid web address" in the source tree: grep -R "You must specify a valid web address" .
  • You will find this message in the transations: "core-index-import/warning-web-address": "You must specify a valid web address (URL) to import."
  • Now search for the identifier of the message: grep -R "core-index-import/warning-web-address" ..
  • The only Javascript file that contains this is ./main/webapp/modules/core/scripts/index/default-importing-sources/sources.js, so the error is coming from there.
  • Open this file and look for warning-web-address.

With this method you do not need to understand OpenRefine's structure much: you can locate the code you are interested in just by following references, starting from UI text.

@kushthedude
Copy link
Member

@kushthedude kushthedude commented Apr 5, 2020

I think we can just add a function in UI to trim the whitespaces in the input URL before it is sent to the Regex for validation, or can we just add a trim function in the regex function?

@Nishtha3512
Copy link

@Nishtha3512 Nishtha3512 commented Apr 5, 2020

I think we can just add a function in UI to trim the whitespaces in the input URL before it is sent to the Regex for validation, or can we just add a trim function in the regex function?

Yes am also trying to add trim function to resolve this issue :)

Nishtha3512 added a commit to Nishtha3512/OpenRefine that referenced this issue Apr 11, 2020
Nishtha3512 added a commit to Nishtha3512/OpenRefine that referenced this issue Apr 11, 2020
Nishtha3512 added a commit to Nishtha3512/OpenRefine that referenced this issue Apr 11, 2020
Nishtha3512 added a commit to Nishtha3512/OpenRefine that referenced this issue Apr 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.