Opened 9 years ago

Closed 9 years ago

# path is always incorrect

Reported by: Owned by: artem@… Radek Bartoň normal ScreenshotsPlugin normal path artem@… 0.10

### Description

Hello,

I can not upload and view images with the ScreenshotsPlusgin.

Here is the config:

[components]
acct_mgr.api.accountmanager = enabled
acct_mgr.htfile.htpasswdstore = enabled
acct_mgr.pwhash.htpasswdhashmethod = enabled
acct_mgr.web_ui.accountmodule = enabled
tracdiscussion.core.discussioncore = enabled
tracdiscussion.init.discussioninit = enabled
tracdiscussion.search.discussionsearch = enabled
tracdiscussion.timeline.discussiontimeline = enabled
tracdiscussion.wiki.discussionwiki = enabled
tracscreenshots.api.screenshotsapi = enabled
tracscreenshots.core.screenshotscore = enabled
tracscreenshots.init.screenshotsinit = enabled
tracscreenshots.matrix_view.screenshotsmatrixview = enabled
tracscreenshots.wiki.screenshotswiki = enabled
tracscreenshots.tags.screenshotstags = disabled

[screenshots]
component = component1
path = /home/artem/public_html/screenshots
show_name = true
title = Screenshots
version = 1.0


Sometimes I get the following error, when I try to upload an image:

Error storing file. Is directory specified in path config option in [screenshots] section of trac.ini existing?


And sometimes the image upload works fine. The Plugin creates the subdirectory /home/artem/public_html/screenshots/1 and also stores the uploaded image in there (test-154x92.png), but the image does not get displayed on the Screenshots page. There is only a link to with Edit and Remove links.

<td>
<div class="image">
<a href="/trac/screenshots/1" title="test">
<img src="/trac/screenshots/1?width=160;height=120;format=raw"
alt="test" width="160" height="120"/>
</a>
</div>
<div class="controls">
<a href="/trac/screenshots?action=edit;id=1;index=0">Edit</a>
<a href="/trac/screenshots?action=delete;id=1;index=0">Delete</a>
</div>
</td>


After clicking on the link I get

Screenshot not found.

My system:

Trac: 0.10.3 Debian package
Server: Apache 2.2.3-4+etch1 + mod_python
Database: sqlite
OS: Debian Etch Linux


Any Ideas?

### comment:1 Changed 9 years ago by Radek Bartoň

Priority: normal → high normal → major new → assigned

I tested uploading screenshots into directory outside Trac environment (which I never did before) and seems to work fine. First check your permissions on /home/artem/public_html/screenshots if apache has write access enabled. This may solve "Error storing file." For the second issue I would need debug log from uploading and accessing. See BugReporting how to enable DEBUG log level. BTW: I noticed that there is visible input for tags if tags component is disabled. I'll fix that eventually.

### comment:2 Changed 9 years ago by empireunleashed@…

I would like to comment on the above issue as well. I am having the same problem as well but I think i might be able to provide some info for you.

For starters, here is my configuration:

[components]
acct_mgr.htfile.htpasswdstore = enabled
acct_mgr.web_ui.accountmodule = enabled
acct_mgr.web_ui.registrationmodule = disabled

themeengine.* = enabled
consultanttheme.* = enabled
defaulttheme.* = enabled
gamedevtheme.* = enabled
intrablogtheme.* = enabled
mentalaxistheme.* = enabled

restrictedarea.filter = enabled

syscss.* = enabled

tracdiscussion.api.discussionapi = enabled
tracdiscussion.core.discussioncore = enabled
tracdiscussion.init.discussioninit = enabled
tracdiscussion.search.discussionsearch = enabled
tracdiscussion.timeline.discussiontimeline = enabled
tracdiscussion.wiki.discussionwiki = enabled

tracscreenshots.api.screenshotsapi = enabled
tracscreenshots.core.screenshotscore = enabled
tracscreenshots.init.screenshotsinit = enabled
tracscreenshots.matrix_view.screenshotsmatrixview = enabled
tracscreenshots.tags.screenshotstags = enabled
tracscreenshots.wiki.screenshotswiki = enabled

tractoc.* = enabled

visitcounter.core.* = enabled
visitcounter.core.visitcountermacro = disabled
visitcounter.init.* = enabled
visitcounter.init.visitcounterinit = disabled

trac.wiki.web_ui.wikimodule = disabled

tractags.* = enabled
tractags.api.tagengine = enabled
tractags.macros.tagmacros = enabled
tractags.ticket.tickettags = enabled
tractags.web_ui.tagsmodule = enabled
tractags.web_ui.tagswikimodule = enabled
tractags.wiki.wikitags = enabled

[screenshots]
component =
path = /opt/trac/testbed1/htdocs/pictures
show_name = true
title = Pictures
version =


and here is my file system info

drwxr-xr-x  2 apachectl apachectl 4096 2007-12-12 22:41 css
drwxr-xr-x  2 apachectl apachectl 4096 2007-12-14 20:50 media
drwxr-xr-x 19 apachectl apachectl 4096 2007-12-15 10:23 pictures
root@euweb:/opt/trac/testbed1/htdocs#


My user and group permission are set to the same as apache's, so they have access.

I tried to up load files of different formats and got the appropriate error. However when I tried to upload .jpg pictures, it errored out with

"Error storing file. Is directory specified in path config option in [screenshots] section of trac.ini existing?"


instead of the upsupported format error like the other ones. I am not sure if .jpg is supported or not, but all I can upload is .png format, that's it.

Also when i try and upload the wrong picture format, it gives my just the "upsupported format error", but when i try to upload a .jpg it gives me the error "Error storing file" error, but still creates an empty numbered directory with no picture in it, so my /pictures directory is just filling up with numbers with nothing in them.

Thats all i have for right now, if you could provide some leads on how this plugin is suppose to function and why it is doing what is it doing, I would appreciate it. Thanks man!

### comment:3 Changed 9 years ago by Radek Bartoň

Thanks for re-reporting this. The "Unsupported uploaded file type." message is caused by plugin's configuration. There is ext configuration option with default jpg png which allows upload of files of theese types. You can extend it to any type you want to be uploaded and PIL supports. But the above error shouldn't be there if your path is setted correctly (which seems so). As well as you would setted it incorrectly no directories or DB entries should be created if you upload something only above error message sould be displayed. I don't have a clue what is source of probles you two are experiencing but maybe debug log would tell me more. So, please, collect it (BugReporting) and attach it here.

### comment:4 Changed 9 years ago by Radek Bartoň

Priority: high → normal major → normal

Any news?

### comment:5 Changed 9 years ago by anonymous

"Error storing file" issue is caused by IE7 too. In my case, configuration was ok, but the plugin refused to work with IE7. After some debbuging, I realized that the problem was that IE is sending full windows path of the uploaded file, causing mkdir to fail. I'll attach a patch that solves this problem. In the meantime, you can use Firefox, it seems not affected by this bug.

### Changed 9 years ago by Mariano Reingart

IE7 upload file path patch (get basename of uploaded file, not full path)

### comment:6 Changed 9 years ago by Radek Bartoň

Yes, I'm aware that similar error may occur on Windows because I appended that conversion in hope to fix this ticket. I fixed this in DownloadsPlugin already but I forgot to fix it here. The question is what was causing this on Linux and if it is still actual?

### comment:7 Changed 9 years ago by Radek Bartoň

r3271 should fix issue on Windows but this is not same reason why this ticket was opened :-(

### comment:8 Changed 9 years ago by Radek Bartoň

Resolution: → fixed assigned → closed

Closing due to changes of affected code and lack of feedback.

### Modify Ticket

Change Properties