Wrong files directory path initialization

z.stolar - February 16, 2009 - 09:42
Project:Taxonomy Image
Version:6.x-1.5
Component:Code
Category:bug report
Priority:normal
Assigned:z.stolar
Status:closed
Description

in taxonomy_image.admin.inc, the wrong path is saved into the database, and this causes problems once the files directory changes place.
Line 26 states:

<?php
$files_path
= variable_get('file_directory_path', 'files') .'/';
?>

While it should simply be:

<?php
$files_path
= file_directory_path();
?>

#1

z.stolar - February 16, 2009 - 10:07
Assigned to:Anonymous» z.stolar

Actually the problem is deeper.
The path to be saved in the DB is the relative path under 'files'. Then, during display, the full path should be reconstructed. A patch is currently under work.

#2

z.stolar - February 16, 2009 - 10:20

Attached is a patch that should fix it for future uploads. It doesn't, however, fixes existing image paths in DB.

AttachmentSize
taxonomy_image_correct_path.patch 1.23 KB

#3

z.stolar - February 16, 2009 - 10:20
Status:active» needs review

#4

NancyDru - February 17, 2009 - 18:58
Status:needs review» fixed

Wow, it must be time for a new release; your patch wasn't even close to the -dev code I have.

#5

NancyDru - February 16, 2009 - 22:17
Status:fixed» needs work

I backed this out. My testing was messed up by the cache. With your change, every site would be broken. A hook_update_N is mandatory for this. I'm thinking of a different way to go.

The "term_image" table stores the same value that is in the "files" table, which is the full path name, including the "file_directory_path()". These need to match currently. I see this as de-normalizing the db.

#6

z.stolar - February 17, 2009 - 07:59

Indeed, cache should be cleared, and DB entries should be changed. I'll try to add it.

#7

NancyDru - February 17, 2009 - 14:37

I am still debating which is the right approach. FYI, there is a slight wrinkle in this that comes from #305656: Link to external image.

#8

NancyDru - February 17, 2009 - 18:03
Status:needs work» active

I have the hook_update functioning; I just need a bit more testing.

#9

NancyDru - February 17, 2009 - 18:57
Status:active» fixed

Committed to 6.x only.

#10

System Message - March 3, 2009 - 19:00
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.