nemomobile / buteo-sync-plugin-carddav

CardDAV sync plugin for Buteo
8 stars 3 forks source link

[carddav] Improve URL path repetition detection logic #6

Closed chriadam closed 9 years ago

chriadam commented 9 years ago

Some services (such as self-hosted OwnCloud servers) have a base url which includes both a host and a path segment. When performing later requests to another path (e.g., a user principals url request), we need to ensure that we do not duplicate the suffix path-segment from the base url, as it may already appear as a prefix in the request-path.

e.g.: baseUrl: http://my.oc.tld/owncloud/remote.php/carddav request: /owncloud/remote.php/carddav/principals/fred result: http://my.oc.tld/owncloud/remote.php/carddav/principals/fred

VDVsx commented 9 years ago

LGTM.

florianjacob commented 9 years ago

@chriadam I'd love to test the patch against my ownCloud instance, but I can't get buteo-sync-plugin-carddav to build in the latest SailfishOS IDE 1412. Do I need another IDE, or do anything else besides opening and building it in the regular Sailfish IDE to make this work?

23:05:12: Starting "/home/florian/.config/SailfishBeta1/mer-sdk-tools/MerSDK/SailfishOS-armv7hl/qmake" /home/florian/Programming/SailfishOS/buteo-sync-plugin-carddav/buteo-sync-plugin-carddav.pro -r -spec linux-g++ CONFIG+=debug
Building target platforms: armv7hl-meego-linux
Building for target armv7hl-meego-linux
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.qaP8iz
Usage: /usr/lib/qt5/bin/qmake [mode] [options] [files]

QMake has two modes, one mode for generating project files based on
some heuristics, and the other for generating makefiles. Normally you
shouldn't need to specify a mode, as makefile generation is the default
mode for qmake, but you may use this to test qmake on an existing project

Mode:
  -project       Put qmake into project file generation mode
                 In this mode qmake interprets files as files to
                 be built,
                 defaults to *; *; *; *.ts; *.xlf; *.qrc
                 Note: The created .pro file probably will 
                 need to be edited. For example add the QT variable to 
                 specify what modules are required.
  -makefile      Put qmake into makefile generation mode (default)
                 In this mode qmake interprets files as project files to
                 be processed, if skipped qmake will try to find a project
                 file in your current working directory

Warnings Options:
  -Wnone         Turn off all warnings; specific ones may be re-enabled by
                 later -W options
  -Wall          Turn on all warnings
  -Wparser       Turn on parser warnings
  -Wlogic        Turn on logic warnings (on by default)
  -Wdeprecated   Turn on deprecation warnings (on by default)

Options:
   * You can place any variable assignment in options and it will be     *
   * processed as if it was in [files]. These assignments will be parsed *
   * before [files].                                                     *
  -o file        Write output to file
  -d             Increase debug level
  -t templ       Overrides TEMPLATE as templ
  -tp prefix     Overrides TEMPLATE so that prefix is prefixed into the value
  -help          This help
  -v             Version information
  -after         All variable assignments after this will be
                 parsed after [files]
  -norecursive   Don't do a recursive search
  -recursive     Do a recursive search
  -set <prop> <value> Set persistent property
  -unset <prop>  Unset persistent property
  -query <prop>  Query persistent property. Show all if <prop> is empty.
  -cache file    Use file as cache           [makefile mode only]
  -spec spec     Use spec as QMAKESPEC       [makefile mode only]
  -nocache       Don't use a cache file      [makefile mode only]
  -nodepend      Don't generate dependencies [makefile mode only]
  -nomoc         Don't generate moc targets  [makefile mode only]
  -nopwd         Don't look for files in pwd [project mode only]

RPM build errors:
error: Bad exit status from /var/tmp/rpm-tmp.qaP8iz (%build)
    Bad exit status from /var/tmp/rpm-tmp.qaP8iz (%build)
chriadam commented 9 years ago

@florianjacob I normally use the command line to build.

Does your version of the sdk come with the "mb2" tool? That is what I use to build rpm packages locally. Otherwise, qmake && make -j5 and then scp the executable to the /usr/lib/buteo-plugins-qt5/oopp/ directory.

chriadam commented 9 years ago

Actually, I think this PR is wrong, after all. Instead of merely detecting path segment duplication, we should rather assume that the path fragment is a complete, absolute path. See: https://github.com/nemomobile/buteo-sync-plugin-carddav/pull/7