Skip to content

Commit

Permalink
owncloudcmd: Fix url handling with csync, make owncloudcmd sync again.
Browse files Browse the repository at this point in the history
This fixes mirall issue #2211
  • Loading branch information
Klaas Freitag committed Oct 11, 2014
1 parent 631e679 commit 8eaeba6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/owncloudcmd/owncloudcmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ int main(int argc, char **argv) {

parseOptions( app.arguments(), &options );

QUrl url = QUrl::fromUserInput(options.target_url);
QUrl url = QUrl::fromUserInput(options.target_url);

// Order of retrieval attempt (later attempts override earlier ones):
// 1. From URL
Expand Down Expand Up @@ -274,11 +274,15 @@ int main(int argc, char **argv) {
url.setPassword(password);
}

// take the unmodified url to pass to csync_create()
QByteArray remUrl = options.target_url.toUtf8();

Account account;

// Find the folder and the original owncloud url
QStringList splitted = url.path().split(account.davPath());
url.setPath(splitted.value(0));

url.setScheme(url.scheme().replace("owncloud", "http"));
QString folder = splitted.value(1);

Expand All @@ -295,8 +299,9 @@ int main(int argc, char **argv) {
restart_sync:

CSYNC *_csync_ctx;

if( csync_create( &_csync_ctx, options.source_dir.toUtf8(),
url.toEncoded().constData()) < 0 ) {
remUrl.constData()) < 0 ) {
qFatal("Unable to create csync-context!");
return EXIT_FAILURE;
}
Expand Down Expand Up @@ -359,6 +364,7 @@ int main(int argc, char **argv) {

OwncloudCmd owncloudCmd;
SyncJournalDb db(options.source_dir);

SyncEngine engine(_csync_ctx, options.source_dir, QUrl(options.target_url).path(), folder, &db);
QObject::connect(&engine, SIGNAL(finished()), &app, SLOT(quit()));
QObject::connect(&engine, SIGNAL(transmissionProgress(Progress::Info)), &owncloudCmd, SLOT(transmissionProgressSlot()));
Expand Down

0 comments on commit 8eaeba6

Please sign in to comment.