From f74d11c0c3c4a3bcd733499edd63f8e31389a3a3 Mon Sep 17 00:00:00 2001
From: Bartek Przybylski <bart.p.pl@gmail.com>
Date: Thu, 29 Mar 2012 20:45:21 +0200
Subject: [PATCH] fix gallery sharing when root is not /

---
 apps/gallery/ajax/galleryOp.php | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/apps/gallery/ajax/galleryOp.php b/apps/gallery/ajax/galleryOp.php
index b0433898cd..1b3ad48f56 100644
--- a/apps/gallery/ajax/galleryOp.php
+++ b/apps/gallery/ajax/galleryOp.php
@@ -127,6 +127,9 @@ function handleGetGallery($path) {
 function handleShare($path, $share, $recursive) {
   $recursive = $recursive == 'true' ? 1 : 0;
   $owner = OC_User::getUser();
+  $root = OC_Preferences::getValue(OC_User::getUser(),'gallery', 'root', '/');
+  $path = utf8_decode(rtrim($root.$path,'/'));
+  if($path == '') $path = '/';
   $r = OC_Gallery_Album::find($owner, null, $path);
   if ($row = $r->fetchRow()) {
     $albumId = $row['album_id'];
-- 
GitLab