Skip to content
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 6.04 -> 7.0.0 upgrade fails with "Failed to upgrade "files_sharing"" revisited.#9810 #10068

Closed
mc-comanescu opened this issue Jul 30, 2014 · 2 comments

Comments

@mc-comanescu
Copy link

Hi guys, I've started with 6.0.2, upgraded to 6.0.4 with no issues and had a friend yesterday who created a folder "You brother's wedding" on the server and uploaded a bunch a pics, and shared it afterwards with the family.. Now tonight I tried an upgrade from 6 to 7 .. and it dies with apparent bug #9810 .
However calling the console.php in command line, yelds the issue elsewhere,

An unhandled exception has been thrown: exception 'DatabaseException' with message 'An exception occurred while executing 'UPDATE "oc_share" SET "file_target" = CASE "id" WHEN 3 THEN '/Shared/Your brother's wedding' WHEN 13 THEN '/Shared/photos' WHEN 14 THEN '/Sh...

SQLSTATE[HY000]: General error: 1 near "s": syntax error' in /var/www/owncloud/lib/private/db.php:159
Stack trace:
#0 /var/www/owncloud/lib/public/db.php(47): OC_DB::prepare('UPDATE *PREFIX...', NULL, NULL) #1 /var/www/owncloud/apps/files_sharing/appinfo/update.php(109): OCP\DB::prepare('UPDATE *PREFIX...')
#2 /var/www/owncloud/apps/files_sharing/appinfo/update.php(10): removeSharedFolder() #3 /var/www/owncloud/lib/private/app.php(1179): include('/var/www/ownclo..

Quering the sqlite database for the oc_share table confirms that the share name is "Your brother's wedding" which when in the given prepared statement doesn't escape the right way. I understand what the error means, however I'm not sure what a good approach would be in this case? Escape the ' in the sql tables?, try to parse the query and escape it before the prepare statement? I'm by far familiar with the code, and hope for some guidance. Lastly, I also want to thank for the awesome project.

@mc-comanescu
Copy link
Author

As a followup, replacing the quote in the offending share's name with _ in the mentioned table let me finish the update:

UPDATE oc_share set file_target="Your brother_s wedding" where file_target="Your brother's wedding";

and from the command line,

php console.php upgrade
finished the installation in my case and I was able to be back online on 7.

@schiessle
Copy link
Contributor

This is already fixed for OC7.0.1: #9867

sorry for the inconvenience. If you want you can apply the patch right away to your installation, it's only a few lines of code. Afterwards the upgrade should work.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants