opendatateam / udata

Customizable and skinnable social platform dedicated to open data.
http://udata.readthedocs.org
GNU Affero General Public License v3.0
240 stars 87 forks source link

Automatic URL considered as invalid when creating ressource on local instance (http://127.0.0.1:7000) #3093

Open rv2931 opened 3 months ago

rv2931 commented 3 months ago

I'm testing udata with local docker stack The domain name is so http://127.0.0.0.1:7000

When I try to create a new dataset for testing, I can't validate the ressource (CSV upload) because the URL that is generated is concidered as invalid URL : http://127.0.0.1:7000/en/admin/dataset/new/ URL auto generated: http://127.0.0.1:7000/s/resources/dataset1/20240718-053900/ports.csv

Error message on URL field: Please enter a valid URL

Detailed Description

I've started from scrach a docker instance on local dev plateform I've created an organsiation when I try to create a new dataset based on a CSV, on the page asking to upload the file, I'm stuck with the error "Please enter a valid URL" for the resource, but no way to bypass as the field is read only So finally I can't really test the dev instance

Context

The criterias of what is a valid URL is not given in question mark Mayeb it is due to domain format nom:port or maybe it is due to presence of IP adress, or maybe 127.0.0.1 If it is, so this should be present in pre-requisite for mounting an instance Or be more tolerant on domain name

Possible Implementation

Your Environment

This is docker stack based on podman I'm on Windows 10 entreprise

Capture

maudetes commented 3 months ago

Thank you for your ticket.

I think some configurations are needed in your udata.cfg to make it work with local URLs. See this udata.cfg sample, with some properties that may be related with your issue:

URLS_ALLOW_LOCAL = True
URLS_ALLOWED_TLDS = Defaults.URLS_ALLOWED_TLDS | set(['local'])

RESOURCES_FILE_ALLOWED_DOMAINS = ['*']

I would also recommend using the dev.local:7000 URL locally as described in this documentation.

You may see more logs on the udata server backend?

rv2931 commented 3 months ago

Thank you for the rapid answer This configuration should solve my problem ! "RTFM" For dns dev.local solution, basically I've not the permissions to edit hosts file on my machine

rv2931 commented 3 months ago

So I checked. in fact it was already the configuration values I'm using as I followed the at first try The only thing I can't do to follow completly the recommandations with my machine is to edit the domain name in etc/hosts to get dev.local:7000 but I tried with http://localhost:7000 and the result is the same. I'm on windows on professional computer and I'm not admin user I tried with ports 80:7000 and http://localhost/... without port, this is the same invalid error message so this is not due to the host:port format I tried with adding explicitlyURLS_ALLOWED_SCHEMES=('http', 'https', 'ftp', 'ftps'), same error I triedURLS_ALLOWED_TLDS = Defaults.URLS_ALLOWED_TLDS | set(['localhost']), same error