Skip to content

Recurring change of file_target in oc_share #10678

Closed

Description

@lnxbil

Hi,

I have a folder shared with two people and the file_target in oc_share gets incremented:

/Shared File
/Shared File (2)

This name is visible for the user aswell. I can change this by SQL and if works for roughly a day and the gets automatically renamed. The share is not altered by myself, it's automatically. The SQL i used is this (PostgreSQL):

update oc_share set file_target = replace( file_target, ' (2)','');

Problem was spotted on a client machine with desktop sync while the very folder was synchronized (instead of /). Therefore it works one day and on the other day it stars complaining.

I do not know it this bug is already known, yet I didn't found something related in the search.

Another problem with this is, that if I share a folder with a user A for rw and a group G for r (user A also in group G) this user will see the folder and it's (2) folder.

I encounter this on 7.0.2 on two different owncloud installations. If you need further information, don't hesitate to ask.

Best,
Andreas

Activity

  1. karlitschek commented on Aug 28, 2014

    @karlitschek
    Contributor

    @schiesbn

  2. PVince81 commented on Aug 28, 2014

    @PVince81
    Contributor

    @lnxbil thanks for the report. I also haven't heard of such issue before.

    Would you mind using the issue template to provide more information about your setup ?
    https://raw.github.com/owncloud/core/master/issue_template.md

    Would be good to know whether you had encryption enabled and maybe using external storage ?

  3. lnxbil commented on Aug 28, 2014

    @lnxbil
    Author

    Steps to reproduce

    1. Share Folder with more than one person (via multiple share, not via group)
    2. Folder is not shared with the same name for all persons (SQL: file_target column), ownCloud 7 added (2) to the name
    3. Also look at the database

    Alternative approach

    1. Share Folder with Person A and share also with Group B where Person A is also member of
    2. look at shared folders, Person A will see two shares, one with (2)

    Expected behaviour

    Name should be the same for all users which see the share.

    Actual behaviour

    Name is incremented by (number)

    Server configuration

    I tested it on two different systems
    Operating system:
    Debian Wheezy, amd64 (both)
    Web server:
    Apache 2.2 (both)
    Database:
    PostgreSQL 9.2 and 9.3
    PHP version:
    PHP 5.4.4-14+deb7u14
    ownCloud version: (see ownCloud admin page)
    ownCloud 7.0.2 (stable) - Installed via Debian-Repository
    Updated from an older ownCloud or fresh install:
    One yes, other no
    List of activated apps:
    LDAP, Activity, External Site, Share Files, Picture, Text Editor, PDF Viewer, Full Text Search
    The content of config/config.php:

    <?php
    $CONFIG = array (
      'instanceid' => 'XXX',
      'passwordsalt' => 'XXX',
      'datadirectory' => '/var/www/owncloud/data',
      'version' => '7.0.2.1',
      'installed' => true,
      'maintenance' => false,
      'dbtype' => 'pgsql',
      'dbname' => 'owncloud',
      'dbhost' => 'localhost',
      'dbtableprefix' => 'oc_',
      'dbuser' => 'owncloud',
      'dbpassword' => 'XXX',
      'forcessl' => false,
      'theme' => 'XXX',
      'default_language' => 'de_DE',
      'appstoreenabled' => true,
      'enable_previews' => false,
      'apps_paths' => 
      array (
        0 => 
        array (
          'path' => '/var/www/owncloud/apps',
          'url' => '/apps',
          'writable' => false,
        ),
        // currently empty
        1 => 
        array (
          'path' => '/var/www/owncloud/myapps',
          'url' => '/myapps',
          'writable' => true,
        ),
      ),
      'ldapIgnoreNamingRules' => false,
      'skeletondirectory' => '/var/www/owncloud/themes/XXX/skeleton',
      'share_folder' => '/Shared',
      'trusted_domains' => 
      array (
        0 => 'XXX',
      ),
      'knowledgebaseenabled' => false,
      'loglevel' => 1,
      'logtimezone' => 'Europe/Berlin',
      'log_authfailip' => true,
      'log_rotate_size' => 104857600,
      'enable_avatars' => false,
    );
    
    

    Are you using external storage, if yes which one: local/smb/sftp/...
    First: configured, but not used
    Second: DropBox

    Are you using encryption: yes/no
    Both times, but using selective redirects in Apache to allow anonymous sharing without SSL, everything else only SSL

    Client configuration

    Browser:
    Current Chrome and Firefox ESR

    Operating system:
    Windows 7, Debian Wheezy

    Logs

    Web server error log

    nothing interessting with respect to the error
    

    ownCloud log (data/owncloud.log)

    nothing interessting with respect to the error
    

    Browser log

    nothing interessting with respect to the error
    
  4. laubblatt commented on Aug 28, 2014

    @laubblatt

    Hi, since the update of the server to version 7 last week we have the same issue.
    The main folder in Shared is automatically renamed, seemingly on a daily basis.
    /Shared/Folder/
    /Shared/Folder (2)/
    /Shared/Folder (2) (2)/
    etc. this causes large traffic and path problems!
    Apparently the owner of the shared folder has not such an behavior.
    I hope you can trace the problem.

  5. PVince81 commented on Aug 29, 2014

    @PVince81
    Contributor

    This behavior already existed in OC 6. When a file is shared multiple times with the same user through multiple groups, the file will appear multiple times.

    There is work in progress that tries to properly group them: #10107

    But if you guys say that the target name changes in the database multiple times (auto-rename from "folder" to "folder (2)" then later back to "folder") then this is a bug and shouldn't happen.

    Is the latter what you are observing ?
    The auto-renaming should only happen once.

  6. lnxbil commented on Aug 29, 2014

    @lnxbil
    Author

    @PVince81: In OC6 I never noticed multiple share paths yielding in multi display. It worked as it should be - shown once with the most permissions possible (rw in my case). I had a folder shared to big group in OC (ro) and reshared to a group of admins - subset of the former group - (rw) and the folder only appeared once. This is the same in OC7 if I rename the file_target by hand to the same name, it workes as it has in OC6 and IMHO and should be in general.

    I rechecked: If I share the folder with a third person, the file_target is correct. Let's see when it gets changed. I tried several cron.php executions by hand and it does not get changed.

  7. lnxbil commented on Sep 4, 2014

    @lnxbil
    Author

    Currently, it's bugging me big time, therefore this database side fix for my problem (PostgreSQL):

    CREATE OR REPLACE FUNCTION tf_modify_file_target()
    RETURNS TRIGGER AS $$
    BEGIN
        /* Remove ' (2)' from string */
        NEW.file_target := REPLACE( NEW.file_target, ' (2)', '' );
        RETURN NEW;
    END;
    $$ LANGUAGE plpgsql
    ;
    DROP TRIGGER IF EXISTS tr_modify_file_target ON oc_share;
    CREATE TRIGGER tr_modify_file_target
        BEFORE INSERT OR UPDATE ON oc_share
        FOR EACH ROW EXECUTE PROCEDURE tf_modify_file_target();
    
  8. PVince81 commented on Sep 4, 2014

    @PVince81
    Contributor

    @lnxbil just re-checked OC 6.0.5 and you're right, the multiple shares get merged into a single entry.
    So this could be considered as a regression introduced by the new sharing approach in OC 7.

    This PR #10107 should hopefully fix it when it's done.

    @laubblatt if you're getting "(2)" multiple times like "Test (2) (2) (2).txt" then you're having another issue, see #10736 and try disabling 3rd party apps.

  9. PVince81 commented on Sep 4, 2014

    @PVince81
    Contributor

    Similar issue: #9724

  10. added this to the milestone on Sep 5, 2014
  11. modified the milestones: , 2014-sprint-03 on Sep 15, 2014
  12. modified the milestones: , 2014-sprint-04 on Sep 29, 2014
  13. locked as resolved and limited conversation to collaborators on Aug 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions