I'm not exactly sure how useful it will be to have the Pathauto pattern for files defaulted to file/[file:name] especially since when you install the module, [file:name] by default is the basename of the file on the system. Not exactly the most useful. Also this can create conflicts if I named a file '1' so that now the alias file/1 overrides the system path file/1.

Pathauto integration is good and useful, but I don't agree that it's useful enabled by default. Discuss?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Devin Carlson’s picture

My 2¢:

The content editors here always change a file's filename to something more friendly after it's uploaded. It makes finding existing files much easier (on the file listing page, in the Media Browser and when linking to files using CKEditor Link File).

In the event that they don't input a filename manually, they still prefer to pass around poorly formed URLs (example.com/file/new-memo-finaldoc) over plain file IDs since they still give some idea of what file they represent vs. file IDs.

How does pathauto deal with other entities when it comes to aliases conflicting with system paths and are there any ways around it?
Should a filename field be added to the file upload wizard so that users can give files a "proper" filename during upload?
Do any other entity types provide Pathauto integration but are disabled by default? If not, do you think that it will be confusing to users who expect that pathauto just works automatically out-of-the-box?

Dave Reid’s picture

pathauto deals with it by failing to save the alias. I'm just not sure how useful this is to be configured by default. As a pathauto maintainer, I don't really like that we ship with aliases by defaults since most people go in and have to change them anyway, and then have ended up with a bunch of aliases that they don't want or need that have already been generated. I would prefer if site builders made choosing the alias patterns something they had to think about first.

I'd like to get more input on this proposal.

Other things to note:
http://drupal.org/sandbox/damz/1332096 (pathauto integration for all entity types) uses empty string by default.

aaron’s picture

Status: Needs review » Active

I agree with both the points here. On the one hand, I think that it would be best to leave it blank, however, considering that pathauto currently sets some defaults, it might make sense to add a default for file entities as well. However, if we do that, I don't believe that it would be good practice to leave the first element of the URL alias as file/ because of the overriding issue. Perhaps it would be better to call it files/ instead. Otherwise I am neutral as to what direction we choose to go.

aaron’s picture

Status: Active » Needs review
FileSize
736 bytes

This patch makes the pathauto pattern default to files/fid.

aaron’s picture

Status: Active » Needs review

Bumping for review and comment.

aaron’s picture

#4: 1959268-4-pathauto-defaults.patch queued for re-testing.

aaron’s picture

Status: Needs review » Fixed

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

Dave Reid’s picture

Issue summary: View changes
Status: Closed (fixed) » Needs work
Issue tags: -7.x-2.0 alpha blocker +7.x-2.0 release blocker

Encountered this on several projects, I'm still thinking it would be better to be blank by default.

Dave Reid’s picture

Another argument against having a default pattern by default, is that is when a file is originally created/uploaded, typically users go in and rename the file name field to a more human-readable name. This means that the file is first created with an alias of files/file-name.pdf and then gets changed to files/nice-pdf-title. For most users that have Pathauto + Redirect both installed, this means that for every file that this happens for, they will have a redirect created that didn't need to exist.

If we are going to provide a default Pathauto pattern, it should only apply if the file is permanent.

  • aaron committed e74d2f2 on 8.x-2.x
    Issue #1959268 by aaron: change the pathauto default to files/[fid].
    
othermachines’s picture

Seems to me providing a pattern is a convenience for some but creates issues for others; leaving it blank is an inconvenience for some and creates no issues.

To me it seems like a no-brainer to leave it blank (FWIW).

joseph.olstad’s picture

@othermachines, can you please provide a patch for setting the pathauto to blank ?

othermachines’s picture

Sure thing. I'm never sure about posting patches when people are disagreeing. :) Two years is a long time though.

joseph.olstad’s picture

Status: Needs review » Fixed

committed in 7.x-2.x branch, thanks

Status: Fixed » Closed (fixed)

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