Fix conflict with Upload path

Christefano - December 4, 2007 - 04:11
Project:Private Upload
Version:5.x-1.0-rc2
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

While troubleshooting 197154 I found a conflict when creating a private or public upload when the Upload path module is enabled. Files are attached successfully but Upload path's use of tokens in the file path are broken.

#1

starbow - December 4, 2007 - 17:45
Title:Conflict with Upload path» Fix conflict with Upload path
Category:bug report» feature request

Great, I will add this to the list of known issues.

#2

errement - October 4, 2008 - 22:46
Version:5.x-1.0-beta2» 6.x-1.0-rc2
Category:feature request» bug report

@starbow,

First of all, thanq for such module.

Wanted to let you know what i have:
-Both Private Upload 6.x-1.0-rc2 & Upload path 6.x-1.0 enabled
-at admin/settings/file-system File system path is set to sites/default/files
-at admin/settings/uploadpath Default pattern for the file path prefix is set to private/[type]/[yyyy]/[mm]
-create a page and upload a file within that page & click save
-i get this message

The selected file could not be copied, because no file by that name exists. Please check that you supplied the correct filename.
Could not move the file (private/[type]/[yyyy]/[mm]/file_uploaded.jpg) to the private directory (sites/default/files/private).

-then i edit that page again, don't change anything on it, just click save and… I GET NO ERROR MESSAGE :)
-Check the file and see that it's successfully in place ==>> private/[type]/[yyyy]/[mm]/file_uploaded.jpg

Hope this could help you find the problem, as i think it's a bug.

What do you think, as i would like to use both modules on my site —not the dev— and not sure if it's secured or not —as i'm not getting anyother error messages—

Last but not least, i also get this under admin/reports/status

Private Upload
Conflict with Upload Path
Private Upload will not work if Upload Path is installed

Thx, and really wish you could find a solution.
Cheers!
:)

N.B.: [type]/[yyyy]/[mm] is authomatically created when i save the page.

#3

starbow - October 8, 2008 - 06:31
Category:bug report» feature request

#4

errement - October 8, 2008 - 23:15
Status:active» postponed (maintainer needs more info)

@starbow,

Thank you for your response. But i'd like to say:

-When you create a new node
-under File attachments-Attach new file: choose file
-click Attach
-Un-check the "Private" checkbox
-Save node

This way you never get the error message, above explained, and the file goes perfectly to its place with no problem.

So i am not sure if this is really a clear feature request category as it's working o.k. this way, and has that bug the other way!

Please need more info to know what to do.

Thank you so much for your time & for such module, as i really would like to use.

#5

cgr - October 15, 2008 - 21:34
Version:6.x-1.0-rc2» 5.x-1.x-dev

I've found that there seems to be a similar issue with uploadpath 5.x-1.1 (not -dev!). I can set the base upload path and define the upload area to be "private", and uploads are put into the correct place. That is,
I go to: Administer -> Site configuration -> File system
I set the "File system path:" to: sites/www/content/files
I set the "Download method" to: Private
and "Save configuration". I then configure access to download pages:
I go to: Administer -> User management -> Access control
I enable "view uploaded files" for administrators and authenticated users.

Then I configure uploadpath:
I go to: Administer -> Site configuration -> File upload paths
and set the default pattern and patterns for each node type.

I then upload a file to a node. The file goes into the correct path as defined in the uploadpath config screen. When I view the node as an administrator or authenticated user and look at the upload file link, it points to:

http://my.web.server/system/files/uploaded.file

However this does not resolve to the actual file. I get a "page not found" error.

Any ideas on how to fix this?

Thanks,
Carl

#6

edvanleeuwen - December 27, 2008 - 23:37

This is something I would like to be solved as well. Now I do not know if any development is done in trying to solve this, but is there something I can do to help, e.g. help in determining the problem or testing?

#7

edvanleeuwen - December 27, 2008 - 23:41

Furthermore, despite the fact that I do not know whether this adds to the process, but I must agree with errement that this is a bug, not a feature request.

#8

edvanleeuwen - December 27, 2008 - 23:44
Version:5.x-1.x-dev» 5.x-1.0-rc2

Changed the version as the problem still exists with the recommended version.

#9

edvanleeuwen - January 4, 2009 - 21:15
Assigned to:Anonymous» edvanleeuwen

Ok, I am in the midst of rewriting this module to cope with upload path. Status so far:

Directory layout

I first tried to put all private files beneath the top level 'private' path. This is difficult and has the disadvantages of not having all files (private or not) in the same place. Furthermore, this would introduce changes to upload path as well, which is undesirable. I am now working on a private dir beneath the public one if needed. So an example (with grouping on nodes) would be:

  • Public: /files/attachments/185/document.doc
  • Private: /files/attachments/185/private/document.doc

Directories are created when needed including '.htaccess'.

Node interaction

Files have en extra option 'private'. The following rules apply:

  • When a node is public, then a file can be either public or private.
  • When a node is private, then a file can only be private.

This is still under development.

File movement

Files are moved from the public to the private part and vice-versa. Therefore, the directories have to be created automatically. Deleting a file is done as well, but when no files reside in the directory, the (private) directory is not deleted (I am a bit reluctant to do that and I do not think it is a big disadvantage).

Settings

As directories are created automatically, this will mean less configuration for the user and less checks in advance. (I think this is an advantage, but remarks are welcome.)

Open issues

In order of importance:

  • How to distribute my amendments: could anyone help me with this?
  • Support for linking to an upload from various nodes.
  • Force files to be private when the node is private (both functional and user friendly, e.g. by using javascript)
  • Update status report/check section when configuring.
  • Testing, e.g. without the upload path module.
  • Convert to 6.x.
  • Clean-up empty dirs.
  • URL sometimes adds a prefix 'system/'; however, this does not bother the functionality. Support request: http://drupal.org/node/354255
  • De-installing this module when there are files private will result in files not being able to use.

I will keep you posted.

#10

edvanleeuwen - December 30, 2008 - 23:04
Category:feature request» task
Status:postponed (maintainer needs more info)» needs work

#11

edvanleeuwen - January 1, 2009 - 21:41
Status:needs work» needs review

Ok, this is the first version I have created and tested. In some of the files I have named this one rc3. Please use for testing purposes only. If you would like to have extensive debug info, please look at the function 'debug' and set the variable 'debugging' to true.

Furthermore, this is my first PHP programme ever and I do not yet know how to do diff's, patches and so on. Please be harsh on the code, but gentle with me ;-) Any remarks are appreciated.

AttachmentSize
private_upload.zip 15.14 KB

#12

edvanleeuwen - January 2, 2009 - 16:03

Patch file (created with WinMerge) for version 6.x.

AttachmentSize
private_upload_rc3.patch 15.83 KB

#13

starbow - January 5, 2009 - 17:31

I attempted to apply this patch, but it is not valid.
See http://drupal.org/node/60234 for guidance.
Also, you should know that I am not likely to accept a patch that makes fundamental changes to the module just to implement this feature, unless those changes have other positive impacts.

#14

edvanleeuwen - January 5, 2009 - 21:52

I will check the guidance section. Thanks.

Also, you should know that I am not likely to accept a patch that makes fundamental changes to the module just to implement this feature, unless those changes have other positive impacts.

I am not sure I understand what you are saying. I am trying to solve the conflict with 'Upload path' and I seem to have managed that. If that is not a positive impact, feel free to dismiss it. I myself am pleased with being able to put my files in a more ordered way in stead of a flat directory accompanied with the public/private function and as I saw that there were more members having the same question I thought I would share it. If that is not what you want, I apologize and keep this for myself.

#15

edvanleeuwen - January 5, 2009 - 20:32
Assigned to:edvanleeuwen» Anonymous
Status:needs review» active

#16

starbow - January 6, 2009 - 01:19
Category:task» feature request

edvanleeuwen: I think it is great that you want to share your work, and it could be very useful to people, especially those stuck on this issue. Please feel free to post your work and share patches. But I don't want you to put in a ton of work, and then be disappointed if your patch does not get rolled into the next version of the module.

But, certainly, if other people use your work, and there is a clamor for it to be added, I will listen to that.

#17

laceiba - January 30, 2009 - 07:51

I think that something that helps to remedy the conflict with upload path would be very useful.

#18

NITEMAN - February 13, 2009 - 11:06

subscibing

#19

Bryan76 - April 22, 2009 - 03:54

Would like this conflict resolved as well.

#20

Jan van Diepen - July 22, 2009 - 15:01

Thanks for the patch. I installed it and it is working the way I like it.

Unfortunately, you introduced an new issue. When attaching a new file to be uploaded and with "default upload privacy settings" set to "private" everything seems to be working fine. When hovering over the attachment you'll notice that the upload privacy setting is "public". This is caused by the fact that, for new attachments, the $file->filepath property does not include the "file directory path" part.

I created a patch to the 6.x-1.0-rc2 version (so it is not a patch to the previous patch).

Enjoy!

AttachmentSize
private_upload_rc4.patch 20.24 KB

#21

edvanleeuwen - July 23, 2009 - 21:25

Thanks for the update, Jan!

#22

seanhead - August 27, 2009 - 06:06

this seems to effect other modules that deal with files. I'm playing with media mover at the moment, and seem to be having similar results.

 
 

Drupal is a registered trademark of Dries Buytaert.