Problem/Motivation

File uploads that contains spaces return an error message that the file is not valid.

Steps to reproduce

1. Install json_form_widget.
2. Create a JSON Form field on a content type.
3. Use a schema that defines a property with "format": "uri". # Do this so it's DKAN agnostic
4. In the widget, type a filename with a space into that field (e.g., "I want to upload this file.pdf").
Attempt to save the node.
Result: The field displays an "Invalid URL" error and prevents saving.

Proposed resolution

Update the valueHandler() to look for fields that represent generic URL/URI, Drupal internal stream wrappers like "public://", "private://", or schema definitions that use uri, url, or data-url formats.

Remaining tasks

Review merge request, which hopefully resolves or at least creates a muse for the solution to this specific issue.
Test this with your own use application and use case.

User interface changes

MR includes a plugin so that you can easily assign the JSON Form Widget to a field in a content type.

API changes

None.

Data model changes

URL and URI strings will now be stored in their encoded formats (""%20") first instead of actual spaces.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

chri5tia created an issue. See original summary.

chri5tia’s picture

Status: Active » Needs review
chri5tia’s picture

Issue summary: View changes

chri5tia changed the visibility of the branch 3589259-enable-support-for to hidden.

chri5tia’s picture

Closed MR11 in favor of MR12 for a better description.

chri5tia changed the visibility of the branch WCMS-28187 to active.

chri5tia changed the visibility of the branch WCMS-28187 to hidden.

dafeder made their first commit to this issue’s fork.