Updated: Comment #15

Problem/Motivation

I have sat down and had a play with this module, and have managed to fix everything I knew of (possible exception being the new issue #1896162: File Alias URL Doesn't respect Private File Field Settings).

The attached patch should be applied against the current 7.x-1.x-dev dated 2011-Nov-15.
There are a few issues with File (Field) Paths 7.x-1.0-beta3, so I worked against 7.x-1.x-dev dated 2012-Aug-10. It appears to function correctly and has some usability tweaks, so I recommend it. This patch may not work with beta-3 (haven't tested).
I am using Drupal 7.19-dev, not that it should matter much.

Fixes in this patch include;

Proposed resolution

See attached patch.

Remaining tasks

So I have tested everything I can think of re files on nodes (adding, changing aliases, removing files, deleting nodes with files etc). I have not tested any views functionality etc, nor anything re private files (again, referring to #1896162: File Alias URL Doesn't respect Private File Field Settings). Please test and let me know how you get on.

This module along with File (Field) Paths module do not have great support at the moment, so it might be a good idea to merge these modules together in the future as a new module, so support will be better.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kclarkson’s picture

neRok,

You are really kicking butt on this module so thank you !!! It may make sense to ask if you can be a maintainer :)

I attempted to apply the patch using git apply -v and here are the errors I am receiving:

git apply -v file_aliases-7.x-2.x-dev-1.patch
file_aliases-7.x-2.x-dev-1.patch:59: trailing whitespace.
db_query("DELETE FROM {url_alias} WHERE source LIKE 'filefield_paths/alias/%%'");
file_aliases-7.x-2.x-dev-1.patch:85: trailing whitespace.
* Implements hook_file_delete().
file_aliases-7.x-2.x-dev-1.patch:86: trailing whitespace.
*/
file_aliases-7.x-2.x-dev-1.patch:87: trailing whitespace.
function file_aliases_file_delete($file) {
file_aliases-7.x-2.x-dev-1.patch:88: trailing whitespace.
$filefield_paths_alias = "filefield_paths/alias/{$file->fid}";
Checking patch CHANGELOG.txt...
Checking patch file_aliases.info...
warning: file_aliases.info has type 100644, expected 100755
error: while searching for:
files[] = file_aliases.install
files[] = file_aliases.module
files[] = modules/filefield_paths.inc

error: patch failed: file_aliases.info:7
error: file_aliases.info: patch does not apply
Checking patch file_aliases.install...
Checking patch file_aliases.module...
Checking patch modules/filefield_paths.inc...

yannickoo’s picture

Status: Needs review » Needs work

The patch should based on the version from the repository and not the current development version because Drupal.org adds some additional info to the .info file.

neRok’s picture

I will have another play tomorrow. Its my first real try at a patch.

yannickoo, can you elaborate a bit more? I went to http://drupal.org/project/file_aliases/git-instructions and used git to grab the master, which gave me the latest version 7 dev. I presumed that was what I needed?!

yannickoo’s picture

Oh okay, then you are right with your way. First patch cool!

neRok’s picture

Status: Needs work » Needs review
FileSize
12.35 KB

The patch wouldnt apply on my machine either. Had to make a local topic branch upon the cloned repository as explained here: http://drupal.org/node/1054616

Anyway, tweaked patch attached. It applies on my machine, but git does come up with some warnings re file permissions. A quick google search revealed this is just a quirk of using gitbash on windows, and isnt a problem.

Albert Volkman’s picture

Status: Needs review » Reviewed & tested by the community

This resolves the issues with current dev.

DamienMcKenna’s picture

Title: New dev version with all the features » Combined patch for all known issues in D7 branch
Status: Reviewed & tested by the community » Needs work

@neRok: You need to re-create the patch after changing your text editor to save all files in UNIX format rather than DOS/Windows format, please check the Drupal Coding Standards if you aren't familiar with that requirement.

neRok’s picture

It is. If you look at the patch, it removes the entire contents of modified files such as file_aliases.module because they were windows endings, and replaces them with unix endings.

Should I open every file and do the same (change the endings), even if there are no other problems/changes in those files? It will become a big patch.

DamienMcKenna’s picture

@neRok: Oh, I just saw that Nano was complaining about line endings changing. If you didn't mind, I recommend separating the two tasks (fix line endings, fix the code) into two patches, so that the actual code changes can be reviewed for what they are, rather than being lost in the mess of line changes.

Albert Volkman’s picture

Deciphered’s picture

While I appreciate the thought of a combined patch, it does mean I'm unable to give each individual contributor their due credit for their individual patches. I will instead treat this issue as a meta-issue, which I truly appreciate.

neRok’s picture

A lot of the issues are intertwined. I actually did the whole patch on my own - but I am not interested in credit anyway. It would be good to see a working version of this module on drupal.org though!

kitikonti’s picture

i could not get it work. i tryed the first patch, i tryed the patch from #5, i tryed them both the same time and i tryed it in combination with the patch from #10 https://drupal.org/node/1909040. but i get allways error on patch apply.

how could i get a working copy of this module? which module Version i should download for patching? Which Patches i should download and in which order i should apply them?

Or is there a way to just make the dev Version of this module working? this would be the simplest solution.

But anyway thx for all your work on These patches.

kitikonti’s picture

Issue summary: View changes

Quick typo fix.

jay.lee.bio’s picture

In my case, once I enabled this module and then disabled it due to error messages & its current general instability, FileField Paths itself stopped working completely. I tried everything I could think of (including uninstalling & deleting both modules and reinstalling FileField Paths, creating a new image field, emptying cache, emptying browser cache, etc.), but the "Enable File (Field) Paths?" field that I should be able to check no longer appears anywhere whatsoever. Maybe it's conflicting with some other module that I'm not aware of, but for now I strongly suggest people thoroughly test this module in a test site first before using it in a live site. I think this module has potential (I absolutely LOVE FileField Paths), and hope that a stable version will be out sometime in the near future.

areke’s picture

Issue summary: View changes
rjensen’s picture

dpintats’s picture

I ended up working and patching this module, without seeing the comprehensive path:
https://drupal.org/node/2256603
https://drupal.org/node/2256545

While these issues are likely resolved in the comprehensive patch, they're there anyway. Also, if the maintainer is concerned that the patch should be broken out into each issue, would it be best to do so and add each patch to each issue on their own? I can help with that if anything.

deanflory’s picture

The patch in #5 fails with the latest 7.x-1.x-dev 2013-Sept-30 version:

patching file file_aliases.install
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file file_aliases.install.rej

patching file file_aliases.module
can't find file to patch at input line 352
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/modules/filefield_paths.inc b/modules/filefield_paths.inc
|index 6c3f0f7..6befe32 100644
|--- a/modules/filefield_paths.inc
|+++ b/modules/filefield_paths.inc
--------------------------
File to patch: modules/filefield_paths.inc
patching file modules/filefield_paths.inc

ar-jan’s picture

@dpintats #17: commits are typically done on a per issue basis, so getting the patches for each individual issue in shape would be good.

Deciphered’s picture

Status: Needs work » Fixed

Module has had extensive work, marking this as fixed.

Status: Fixed » Closed (fixed)

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