zoph: importing images does not work

Bug #90398 reported by Wilfried Horn
12
Affects Status Importance Assigned to Milestone
zoph (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Binary package hint: zoph

As default images are uploaded to a directory that is named after the current date. If it does not yet exist zoph tries to create it using the function create_dir_recursive.
That fails to check wether part of the path of the to be created directory exists and tries to create every directory starting from "/". Since that exists mkdir returns an error and the directory is actually NOT created for which the upload fails. Replacing the function create_dir_recursive by

function create_dir_recursive($directory){
  foreach(split('/',$directory) as $subdir) {
    $nextdir="$nextdir$subdir/";
    if(!is_dir($nextdir)) {
      if(!create_dir($nextdir)) {
        echo "Error creating: $nextdir <br>";
        return 0;
      }
    }
  }
  return 1;
}

has worked for me.

Thanks!

Wilfried

Tags: bitesize

Related branches

Revision history for this message
Niklas Klein (kleinernik) wrote :

I made a backport from the 7.0.2 Version of zoph for the functions create_dir and create_dir_recursive. In the version 6.2 (now in gutsy) the are some errors with the return values. thus there is no need to change the function create_dir_recursive completely, especially we don't need to add an additional check for existing directories.

Changed in zoph:
status: New → Confirmed
Revision history for this message
Niklas Klein (kleinernik) wrote :

Sorry, this is the third time i am patching a package. I just learned how to refer to bugs in lunchpad from the changelog. Therefor i updated my debdiff to a hopefully better formulation in the changelog.

Revision history for this message
Daniel Holbach (dholbach) wrote :

Can somebody of the server-team take a look at it?

Changed in zoph:
assignee: nobody → ubuntu-server
Revision history for this message
Scott Kitterman (kitterman) wrote :

Looks sane. I'm working on it.

Changed in zoph:
assignee: ubuntu-server → kitterman
status: Confirmed → In Progress
Revision history for this message
Scott Kitterman (kitterman) wrote :

Uploaded. Thank you for your contribution. I did have to chang the release in the changelog from feisty to gutsy, so please keep that in mind for future uploads. Good patch.

Changed in zoph:
assignee: kitterman → nobody
importance: Undecided → Medium
status: In Progress → Fix Released
Revision history for this message
Niklas Klein (kleinernik) wrote :

zoph (0.6-2.1ubuntu2) gutsy; urgency=low

  * Import works now with backport from 7.0.2 (cvs of zoph). (LP: #90398)

 -- Niklas Klein <email address hidden> Fri, 7 Sep 2007 13:45:42 +0200

Revision history for this message
muthu (muthu) wrote :

While importing images i got this msg! can anyone help me out

Importing images...
Could not create directory: /data/
Could not create directory: /data/images/
Could not create directory: /data/images/uploads/
Could not create directory: /data/images/uploads/2009.01.08/
File upload failed

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.