Several generated urls miss a base_path() prefix, so the module currently doesn't work when the drupal install is in a subdir of the webroot.
Attached patch fixes some of them. Others are probably missing (maybe in the tinymce plugin ?)
| Comment | File | Size | Author |
|---|---|---|---|
| #26 | asset.patch | 2.32 KB | yched |
| #21 | asset_2.patch | 12.67 KB | yched |
| #17 | asset.patch | 12.35 KB | yched |
| #2 | asset.patch | 11.12 KB | yched |
| asset.patch | 4.98 KB | yched |
Comments
Comment #1
yched commentedComment #2
yched commenteda few more...
Comment #3
true-pal commentedI'm not able to apply the patch:
- Tried the Windows Patch Tool and cygwin
- asset 5.x-1.x-dev 2007-12-20
- patch above in root folder of the asset module
- using command: patch < asset.patch
I got following message:
patching file asset.js
Assertion failed: hunk, file ../patch-2.5.9-src/patch.c, line 354
...
help please
Comment #4
yched commentedSetting title back.
I'm not too familiar with applying patches from the command line (win/Eclipse here), unfortunately.
Maybe the patch simply needs a reroll. I'll check.
Comment #5
yched commentedEr, actually setting back title...
Comment #6
jmlane commentedAre the errors you mentioned the same ones as I am having here: http://drupal.org/node/212653
If so, I will try your patch.
Comment #7
true-pal commentedHELP PLEASE,
could someone provide here an already patched asset.module? please
Thanks in advance
Comment #8
wmostrey commentedHey Yves, thanks a lot for your patch. Did you try it yourself using a subdir? For instance there's no need to use both
base_path()anddrupal_get_path('module','asset'). If the site is in a subdir test, this will result in/test//test/sites/all/modules/....I will work forward from your patch, test it a lot and then bring out a new patch for testing.
Comment #9
wmostrey commentedComment #10
yched commentedthere's no need to use both base_path() and drupal_get_path('module','asset'). If the site is in a subdir test, this will result in /test//test/sites/all/modules/....
No, it results in a path relative to drupal's index.php - guaranteed :-)
Thus, all paths generated to be used as client side urls (for images, js files...) need to care about base_path().
However, my patch is wrong, because
- the preferred way is to let url() do that, instead of prepending base_path() manually.
- there are a couple places where it does add base_path when it shouldn't ;-)
- it misses a few more occurrences.
I'll try to reroll it tomorrow.
Comment #11
wmostrey commentedOK, thanks for this. Please make sure you run a quick test on an installation that doesn't use a subdirectory in order to see that you're not getting double slashes at the beginning of a file's directory (e.g. //sites/all/...).
Comment #12
true-pal commentedthanks for the new dev-release (2008-01-23) but the release is not patched, or am I wrong?
Is there a patched release on schedule?
since (see above #3 & #7) and all my sites in subfolders (not on webroot)
I have the problem that all images (cck asset field) are not clickable i.e. page 404
or a never ending revolving thickbox animation.
hoping for good news
JK
Comment #13
wmostrey commentedThere is no patch yet, so the new release does not include a fix for this yet, we're working on it.
Comment #14
yched commentedUpdated patch, uses url() instead of base_path() previously, and tries to target minimal change.
url($path) handles the case where $path is already an absolute URL (http://www.example.com), so this also simplifies the code in asset_img_preview().
Please make sure you run a quick test on an installation that doesn't use a subdirectory
Truly sorry, but I can't afford that time right now... :-(
I don't see why this would break, though.
Side note : rolling patches for asset would be highly simplified if the files complied with core conventions about trailing whitespaces and space as tabs :-) Many people have their IDE configured to automatically take care of that on file save, which simplify core patching work, but also raises lots of unwanted diff lines when patching files with trailing spaces.
Comment #15
yched commentedchange status
Comment #16
wmostrey commentedyched, thanks so much for your work on this. Could it be that you forgot to attach the patch?
Comment #17
yched commentedLOL - could be :-)
Comment #18
wmostrey commentedThe issue with url() is of course that if you have i18n enabled, such urls will be created:
/en/sites/all/modules/asset/lullacons/doc-option-add.png. Note the prepended "en" for the English language. This file doesn't exist of course. I think the easiest way is to just prepend base_path(). If you want I can take it from here, it looks like you got all places covered where this needs to happen so I can build onwards from your patch.For instance:
Comment #19
yched commentedHm, that's right, base_path() is the way to go...
Comment #20
wmostrey commentedComment #21
yched commentedback to base_path(), then
Comment #22
wmostrey commentedWorks as advertised now. Patch will be committed tonight, thanks so much for this!
As a warning to other users: this patch doesn't apply cleanly to the newest dev version. Some hunks will fail but since those fails are not part of the base_url fixes, you can just leave those be.
Comment #23
true-pal commentedusing asset with lightbox I have already had an error.
Since the sub-directory has not been taken into account.
Original Line in asset.module
$link = '<a href="/'.$a->filepath.'" rel="lightbox[gallery]" title="' . str_replace("\"", "'", $asset['caption']);I have changed to:
$link = '<a href="'.file_create_url($a->filepath).'" rel="lightbox[gallery]" title="' . str_replace("\"", "'", $asset['caption']);Now I'm happy with the asset module :-)
since this is my first bug-fix in a drupal module, please confirm or dismiss it.
Comment #24
yched commentedTrue, I missed that one (I don't use thickbox).
I didn't actually apply the fix, but this is obviously right, so marking as RTBC (even though there's no actual patch)
Comment #25
wmostrey commentedThanks for this Juergen, committed.
Comment #26
yched commentedThe parts in asset.module from patch #21 didn't get committed.
Here's an updated patch.
Comment #27
wmostrey commentedThanks for reporting this yched, it will be rolled out tonight.
Comment #28
wmostrey commentedCommitted, thanks again.
Comment #29
true-pal commentedhello again,
sorry but the bug mentioned in #23 is still open. --> Delete the slash in front of the URL and you will be released :-)
Comment #30
true-pal commentedSorry for sending twice, how to delete this comment?
"hello again,
sorry but the bug mentioned in #23 is still open. --> Delete the slash in front of the URL and you will be released :-)"
Comment #31
wmostrey commentedApplied, thanks!
Comment #32
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.