New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OC 5.0.0 sharing files via web link not working #2291

Closed
PisikeSipelgas opened this Issue Mar 14, 2013 · 58 comments

Comments

Projects
None yet
@PisikeSipelgas

PisikeSipelgas commented Mar 14, 2013

OC 5.0.0 sharing files via web link sends to user an e-mail with URL, but after clicking "download" button it says that "cloud not found".

@laegi

This comment has been minimized.

laegi commented Mar 14, 2013

I can confirm that. Sharing via weblink not working at all in OC 5.0.

Error: "cloud not found"

@peltzi

This comment has been minimized.

peltzi commented Mar 14, 2013

I can confirm that too. Sharing via weblink gives me "cloud not found" error too when trying to download the shared file. I noticed that it also shows the first letter of the filename bellow that error. Log actually shows:

{"app":"PHP","message":"fopen(/var/www/html/owncloud/data/XXXXXX/files/ff/s): failed to open stream: No such file or directory at /var/www/html/owncloud/lib/files/storage/local.php#143","level":2,"time":1363259010}

The actual filename for the file I tried to download was screenshot-1362394056765.png. The same happens with all folders and filenames and log always shows path to users data, file and first letter of the filename.

@tanghus

This comment has been minimized.

Contributor

tanghus commented Mar 14, 2013

@PisikeSipelgas Please update the issue using this template: https://raw.github.com/owncloud/core/master/issue_template.md

@MTGap @schiesbn

@PisikeSipelgas

This comment has been minimized.

PisikeSipelgas commented Mar 14, 2013

Expected behaviour

Should be able to download file.

Actual behaviour

Generates an error "cloud not found"

Steps to reproduce

  1. Share a file with web link (file name for example: test.png).
  2. Open URL from recieved e-mail (https://something/public.php?service=files&t=441c49d0d73b3261cae0be38203ae7ec)
  3. Web page says: Pisike Sipelgas shared the file test.png with you
  4. Click "Download"
  5. https://something/public.php?service=files&t=441c49d0d73b3261cae0be38203ae7ec&download
    Page displays "Cloud not found" error with single "I" letter.

Server configuration

Operating system: FreeBSD 8.3-RELEASE-p3

Web server: Apache 2.2.22

Database: Mysql 5.5.25

PHP version: PHP 5.4.4

ownCloud version: 5.0.0
OC is installed to /usr/local/www/owncloud/
Datastore is: /data/owncloud/

Client configuration

Browser: FF19/IE10/Chrome

Operating system: FreeBSD/Windows

Logs

Web server error log

Insert your webserver log here

client.example.com - - [14/Mar/2013:14:31:46 +0200] "GET /public.php?service=files&t=441c49d0d73b3261cae0be38203ae7ec HTTP/1.1" 200 2562
client.example.com - - [14/Mar/2013:14:31:46 +0200] "GET /remote.php/core.css HTTP/1.1" 304 -
client.example.com - - [14/Mar/2013:14:31:46 +0200] "GET /index.php/apps/files_sharing/css/public.css HTTP/1.1" 304 -
client.example.com - - [14/Mar/2013:14:31:46 +0200] "GET /index.php/core/js/config.js HTTP/1.1" 200 748
client.example.com - - [14/Mar/2013:14:31:46 +0200] "GET /remote.php/core.js HTTP/1.1" 304 -
client.example.com - - [14/Mar/2013:14:31:46 +0200] "GET /index.php/core/routes.json HTTP/1.1" 304 -
client.example.com - - [14/Mar/2013:14:31:46 +0200] "GET /index.php/core/ajax/share.php?fetch=getItemsSharedStatuses&itemType=file HTTP/1.1" 200 76
client.example.com - - [14/Mar/2013:14:31:46 +0200] "GET /cron.php HTTP/1.1" 200 20
client.example.com - - [14/Mar/2013:14:33:46 +0200] "GET /public.php?service=files&t=441c49d0d73b3261cae0be38203ae7ec&download HTTP/1.1" 404 1394

ownCloud log (data/owncloud.log)

{"app":"PHP","message":"fopen(/data/owncloud/Pisike_Sipelgas/files/I): failed to open stream: No such file or directory at /usr/local/www/owncloud/lib/files/storage/local.php#143","level":2,"time":1363264104}

@virusbrain

This comment has been minimized.

virusbrain commented Mar 14, 2013

I have found the following:

In the official owncloud repo file lib/files.php (Line 53 - 55)

if (is_array($files) && count($files) == 1) {
$files = $files[0];
}

In the tar-File i have downloaded there are these lines:

if (count($files) == 1) {
         $files = $files[0];
}

Some failure in packaging?

@pdelange

This comment has been minimized.

pdelange commented Mar 14, 2013

Changed the lines in /lib/files.php to the code in previous post and now sharing works as it should

@schiessle

This comment has been minimized.

Member

schiessle commented Mar 14, 2013

Sadly we discovered this bug only after the release was prepared. In the next bug fix release the issue will be solved. In the meantime you can just update the file like described by @virusbrain

There is another bug if you share a folder with a public link. You can't select multiple files and download them. If you want to fix it before the next bug fix release you can apply this patch: https://github.com/owncloud/core/pull/2272/files

@dkorzhevin

This comment has been minimized.

dkorzhevin commented Mar 19, 2013

I can confirm: this is bug in 5.0 version.

This advice fixes problem:

#2291 (comment)

@mastermin

This comment has been minimized.

mastermin commented Apr 3, 2013

Hi guys,

i have a problem with this solution...

I use

-OC 5.0.3
-PHP Version 5.3.2-1ubuntu4.19
-Apache/2.2.14 (Ubuntu)

/lib/files.php
In my cfg this snippet destroy the files array

if (is_array($files) && count($files) == 1) {
$files = $files[0];
}

$files[0] deliveres a string like that ["filename1","filename2","filename3"].

Everytime function count is calling the result is 1.
But I have select 3 files for download.

PHP tells something about the count function (http://www.php.net/manual/en/function.count.php):
Returns the number of elements in var. If var is not an array or an object with implemented Countable interface, 1 will be returned. There is one exception, if var is NULL, 0 will be returned.

I'm confused...

mastermin

Any ideas?

@mastermin

This comment has been minimized.

mastermin commented Apr 5, 2013

Hi folks,

I'm frustrated :(... the patches above are included in OC 5.0.3.... I have checked this after downloading this one

http://download.owncloud.org/community/owncloud-5.0.3.tar.bz2

What shall I say? It doesn't work.

I get alway the same error: cloud not found...

Is it possible to re-open this issue? More details about that you will find above (2 days ago)...

mastermin

@LukasReschke LukasReschke reopened this Apr 5, 2013

@PisikeSipelgas

This comment has been minimized.

PisikeSipelgas commented Apr 5, 2013

OC 5.0.3: sharing with e-mail and download IS working.

@dirkuos

This comment has been minimized.

dirkuos commented Apr 5, 2013

I tried it again with 5.0.3. I shared a directory with three files in it via link. I open the link from inside my mail. I see all three files, I mark them with the checkboxes. I download the zip file with all three files in it. So I don't see any problem.
Scientifix Linux 6.4, php 5.3.3, apache 2.2.15

@mastermin

This comment has been minimized.

mastermin commented Apr 5, 2013

Ok dirkous,

i will give you a shared link... do you have a mail address?

@dirkuos

This comment has been minimized.

dirkuos commented Apr 5, 2013

Yes, but I won't put it on a public forum. BTW, I'm not an OC developer, just a user. So I can't help you with that.

@mastermin

This comment has been minimized.

mastermin commented Apr 5, 2013

ok, how can i get your mail address?

@mastermin

This comment has been minimized.

mastermin commented Apr 5, 2013

this error occurs in my owncloud.log

{"app":"PHP","message":"fopen(/var/www/owncloud/data/admin/files/Testing/[/"text1.rtf/",/"text2.rtf/",/"text3.rtf/"]) [function.fopen</a>]: failed to open stream: No such file or directory at /var/www/owncloud/lib/files/storage/local.php#143","level":2,"time":1365157213}

@KaiThoma

This comment has been minimized.

KaiThoma commented Apr 5, 2013

I can confirm that creating a share link, copy&pasting it into a browser leads to the message "Cloud not found".

Server: Ubuntu 12.04.2
Database: MySQL 5.5
Browser: Firefox 20.0

I also checked /lib/files.php and line 53 looks like the upper one mentioned above by virusbrain

If you need further information, e.g. logfiles etc. just tell me what to post.

@mastermin

This comment has been minimized.

mastermin commented Apr 5, 2013

Kai, thanks a lot for your confirmation!

Am 05.04.2013 um 23:15 schrieb KaiThoma notifications@github.com:

I can confirm that creating a share link, copy&pasting it into a browser leads to the message "Cloud not found".

Server: Ubuntu 12.04.2
Database: MySQL 5.5
Browser: Firefox 20.0

I also checked /lib/files.php and line 53 looks like to upper one mentioned above by virusbrain

If you need further information, e.g. logfiles etc. just tell me what to post.


Reply to this email directly or view it on GitHub.

@MTGap

This comment has been minimized.

Contributor

MTGap commented Apr 6, 2013

I can't reproduce. Someone has to provide additional details, I tried all possible cases I could think of.

@mastermin

This comment has been minimized.

mastermin commented Apr 7, 2013

Hi mtgap,
many thanks for your testing!

In my case the $files var contains this one:

["text1.rtf","text2.rtf","text3.rtf"]

and the result of count is 1, not 3 like expected.

In my opinion that is a error.

@mastermin

This comment has been minimized.

mastermin commented Apr 8, 2013

Hi folks,

I have written this one:

"Now I have disabled magic_quotes_gpc = Off"

and it works!

For me this issue is solved.

Hope for KaiThoma also?!?!?!
He has the same problem.

@MTGap

This comment has been minimized.

Contributor

MTGap commented Apr 8, 2013

@karlitschek The code in base.php isn't turning off magic quotes as it is supposed to. You changed it recently: #2411

@karlitschek

This comment has been minimized.

Member

karlitschek commented Apr 9, 2013

@MTGap do you have some more information why this happens? I couldn't find a logical error in my code.

@karlitschek

This comment has been minimized.

Member

karlitschek commented Apr 9, 2013

@mastermin or anyone else.

Can you please try to replace the code in lines 403, 404 and 405 or lib/bas.php with:

if(get_magic_quotes_runtime()){
set_magic_quotes_runtime(false);
}

Does this has any effect?

@KaiThoma

This comment has been minimized.

KaiThoma commented Apr 9, 2013

My /etc/php5/apache2/php.ini says:
magic_quotes_gpc = off
magic_quotes_runtime = off
magic_quotes_sybase = off

phpinfo() says:
Version: 5.3.10-1ubuntu3.6
magic_quotes_gpc: Off
magic_quotes_runtime: Off
magic_quotes_sybase: Off

I did never change this configuration and error "Cloud not found" is still present

Is there another place where magic quotes can be enabled?

@KaiThoma

This comment has been minimized.

KaiThoma commented Apr 9, 2013

/lib/base.php formerly contained this code in lines 403-405:
if (get_magic_quotes_gpc()==1) {
ini_set('magic_quotes_runtime', 0);
}

I replaced it with the code mentioned by karlitschek:
if (get_magic_quotes_runtime()) {
set_magic_quotes_runtime(false);
}

But this has still no effect
(yes, I restarted apache, even rebootet the whole machine, just to make sure ;-) )

@karlitschek

This comment has been minimized.

Member

karlitschek commented Apr 9, 2013

@MTGap I think the problem must be somewhere else.

@mastermin

This comment has been minimized.

mastermin commented Apr 9, 2013

hi karlitschek,
question: what do you want to do with

if (get_magic_quotes_runtime()) {
set_magic_quotes_runtime(false);
}

mastermin

@mastermin

This comment has been minimized.

mastermin commented Apr 9, 2013

@KaiThoma: Do you have a owncloud.log for your "Cloud not found" case?

A snippet will be enough, not the whole one.

@mastermin

This comment has been minimized.

mastermin commented Apr 9, 2013

For my case the solution

magic_quotes_gpc = off in php.ini works fine!

here we set the directive on system level (like the php doc is talking about).

I'm not sure about your suggestion with get_magic_quotes_runtime().
In my opinion magic_quotes_runtime is a other one than magic_quotes_gpc... what do you mean?

@KaiThoma

This comment has been minimized.

KaiThoma commented Apr 10, 2013

@mastermin:

{"app":"search_lucene","message":"failed to extract meta information for /kai/files/: Could not open "/var/www/owncloud/data/kai/files/" (does not exist, or is not a file)","level":2,"time":1365537648}

btw, the folder /var/www/owncloud/data/kai/files/ does exist and contains the folder TestBilder where my weblink should point to.

Just wonder if I maybe did something wrong with folder permissions.
I did it exactly like described here: https://owncloud.com/documentation/installation/installing-owncloud-server/install-owncloud-server-on-linux

Ubuntu / Debian:
Go to /var/www/owncloud
Run:
chown -R www-data:www-data config data
chown www-data:www-data apps
chmod 750 apps config
chmod -R 770 data

@mastermin

This comment has been minimized.

mastermin commented Apr 10, 2013

Hi KaiThoma,

thats all? A search_lucene warning will be logged if you try to download more than one file?

My case was another one:

{"app":"PHP","message":"fopen(/var/www/owncloud/data/admin/files/Testing/[/"text1.rtf/",/"text2.rtf/",/"text3.rtf/"]): failed to open stream: No such file or directory at /var/www/owncloud/lib/files/storage/local.php#143","level":2,"time":1365404794}

You see, fopen wants to open a file like [/"text1.rtf/",/"text2.rtf/",/"text3.rtf/"] that don't exist.

My problem was the magic_quote thing.. failed encoding of the elements in the string.

For my understanding, you run into other errors...

Do you have more logs for that?

Please could you give me a shared link to your system or maybe you can send me screenshot of the displayed error?

But how... Does github have a private message feature? I don't know...

@mastermin

This comment has been minimized.

mastermin commented Apr 10, 2013

These search_lucene can't be the problem... that is only a warning log message...

If you have done something wrong with the file permissions, you would have other problems ;)...

@KaiThoma

This comment has been minimized.

KaiThoma commented Apr 10, 2013

@mastermin: for a link to my owncloud you can contact me via skype. just search for kaithoma
sorry, i have no more logs, only the line mentioned above multiple times.

@KaiThoma

This comment has been minimized.

KaiThoma commented Apr 10, 2013

Ok, i found out this:

In file /apps/files_sharing/public.php:
$linkItem['parent'] is empty (index is in array but without value)
$linkItem['file_source'] is 32 (no idea what 32 stands for but it is in deed the file_source for given token in DB)
\OC\Files\Filesystem:getPath() returns null which causes $path to be unset

Two questions:
-Is it valid that $linkItem['parent'] is empty? (I guess yes because it is nullable in DB)
-Is it valid that Filesystem.getPath(32); returns null?

@karlitschek

This comment has been minimized.

Member

karlitschek commented Apr 11, 2013

@MTGap @schiesbn What do you think?

@MTGap

This comment has been minimized.

Contributor

MTGap commented Apr 11, 2013

It's fine that parent is null. Check your oc_filecache table in the database to see if a row exists with id 32.

@KaiThoma

This comment has been minimized.

KaiThoma commented Apr 11, 2013

@MTGap: yes, row with id 32 exists and field name matches the file i like to link to.
Should field path contain the username?
like username/files/picture.jpg?
or just /files/picture.jpg?

@KaiThoma

This comment has been minimized.

KaiThoma commented Apr 12, 2013

I got my problem solved!

table oc_storages contained an entry local::/var/www/owncloud/data/Kai
with uppercase K
but my username ist kai with lowercase k
most likely this happened because i switched my displayname some time ago.

AFAIK i was the last one getting this message "Cloud not found" i guess you can close this issue.

@LogIN-

This comment has been minimized.

LogIN- commented Apr 12, 2013

it could also be wrong http server config, apache or nginx so also check that

@RandolfCarter

This comment has been minimized.

Contributor

RandolfCarter commented Apr 13, 2013

Upgraded from 4.5.8 to 5.0.4 (manually, not with the Automatic Updater, i.e. removing everything but data&config), and was seeing the "Cloud not found"... nothing in the error logs.
The reason was that the share was removed during the upgrade (at least the file didn't show up as shared anymore). Would be cool if the GUI instead of "Cloud not found" could write a more appropriate message like "Share not found?"

Edit: Just checked, strangely enough I still see the old entry for the particular folder in the oc_share table - I now have two entries for the same path but different tokens, and only one of them seems to work... how is this supposed to work? The item_source/item_target values are different, so I guess the old share refers to an old entry in the fs/filecache table, and was never updated to point to the new one? Maybe because my upgrade process was a bit bumpy (#2908)?

@schiessle

This comment has been minimized.

Member

schiessle commented Apr 13, 2013

@KaiThoma display name shouldn't affect the entries in any internal db table. Would be great if you could re-test this by changing the display name again and see if this really effects the public link share.

@xtruthx

This comment has been minimized.

xtruthx commented Apr 15, 2013

hello folks, i need help on this. Got this bug after a Update from 4.5.1a to OC Version 4.5.9. And the mentioned code change did not work, because there is totaly different code sector in files.php then above.

so all old shares via link are broken with "Cloud not found".

Installation is on Debian Squeeze with SQL-Lite and the Customer use this installation for his evaluation.

thx for help

@mastermin

This comment has been minimized.

mastermin commented Apr 16, 2013

@schiesbn and @KaiThoma:
changing display has no effect to shared link. i have done the re-test...
@KaiThoma: maybe you have changed the real name under the hood?

mastermin

@francoistrahan

This comment has been minimized.

francoistrahan commented Apr 19, 2013

Hey there. I have the same probem happening here.

I have a brand new server with a manual installation, no production use and the same problem. I'd really like to see it fixed so I'm willing to help.

My configuration and owncloud installation is under a versionning system so I don't mind messing with the code and / or config and I am also ok to navigate the database.

I don't know your code base and unfortunately don't have that much time to investigate, but I'm more than happy to carry on some tests and give feed back, should it be usefull to anyone...

cheers,

@francoistrahan

This comment has been minimized.

francoistrahan commented Apr 19, 2013

by the way, if I open the link from a browser where I'm logged in, it works. In a browser that's not logged in, does not.

@KaiThoma

This comment has been minimized.

KaiThoma commented May 7, 2013

@schiesbn I tried changing my display name back and forth but did not succeed in reproducing the situation mentioned above.
And I agree with @RandolfCarter that a more detailed errormessage like "Share '/var/www/owncloud/data/Kai' not found" would help finding the problem.

@jancborchardt

This comment has been minimized.

Member

jancborchardt commented Aug 4, 2013

I’m closing this bug because it has been in »Needs Info« state for longer than a month. Please reopen if the error still persists with ownCloud 5.0.9 (the latest stable version) and then please use the issue template.

Or best open a completely new issue because this is probably the longest discussion I ever saw and no one will bother to read it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment