If a URL (internal at least) contains a space, the javascript check returns the link as invalid. I added a check in test, and it works without apparently breaking anything. See comment below for patch.

Comments

msypes’s picture

Here's the patch

msypes’s picture

Sorry. forgot to correct some local code in the patch before uploading

anrikun’s picture

Title: Allow internal links with whitespace » Internal links fail with whitespace

This is not a bug but by design.
What kind of paths are you using that contain spaces?

anrikun’s picture

Title: Internal links fail with whitespace » Allow internal links with whitespace
Category: bug » feature
msypes’s picture

Title: Internal links fail with whitespace » Allow internal links with whitespace

This was from a copy/paste of an internal file link from admin > content > file.
Some of those files have spaces in the names, like My Great Word File.doc, or Annual Report.pdf

The JS was able to get the correct path to the file, but returned the invalid path message. By adding the allowance for spaces, I was able to insert a functioning link to such a file.

I don't like spaces in pathnames any more than the next guy, but there's no guarantee that a casual user won't upload such a file.

hass’s picture

Paths with spaces that file_create_url creates contain encoded spaces (%20). There is one open core bug in D6 to get this invalid links fixed.

bkline’s picture

Category: feature » bug

This is a showstopper for the use of this module. I really don't want to rewrite our software to use another module, but unless this is fixed we'll have to (or maintain our own fork of this one, which is also undesireable). As the OP said, few developers will intentionally create file names with spaces, but most users do it all the time. You've been given a patch which works perfectly. Let's apply it!

anrikun’s picture

Status: Active » Needs review
bkline’s picture

Issue summary: View changes

I have tested the patch. Can we get it applied?

bkline’s picture

Status: Needs review » Reviewed & tested by the community

  • anrikun committed 495b5e2 on 7.x-2.x
    Issue #1620028 by msypes, anrikun: Allow internal links with spaces
    
anrikun’s picture

Title: Allow internal links with whitespace » Allow internal links with spaces
Version: 7.x-2.2 » 7.x-2.x-dev
Category: Bug report » Feature request
Status: Reviewed & tested by the community » Fixed

All right, let's allow spaces but not all white spaces.
Anyway, patch at #2 was incomplete.
I've committed a complete one.

anrikun’s picture

bkline’s picture

Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

bkline’s picture

Any chance this could get released as part of the "preferred version" (as reported by /admin/reports/updates)? It's been over two years.