Always use the webdav path from the Account object.

The Account object has the themed webdav path if it is branded.
This commit is contained in:
Klaas Freitag 2015-09-10 15:39:37 +02:00
parent 93e1ad088c
commit cf7726353a
3 changed files with 19 additions and 13 deletions

View file

@ -185,15 +185,7 @@ void parseOptions( const QStringList& app_args, CmdOptions *options )
}
options->target_url = args.takeLast();
// check if the webDAV path was added to the url and append if not.
if(!options->target_url.endsWith("/")) {
options->target_url.append("/");
}
if( !options->target_url.contains( Theme::instance()->webDavPath() )) {
options->target_url.append(Theme::instance()->webDavPath());
}
if (options->target_url.startsWith("http"))
options->target_url.replace(0, 4, "owncloud");
options->source_dir = args.takeLast();
if (!options->source_dir.endsWith('/')) {
options->source_dir.append('/');
@ -280,6 +272,21 @@ int main(int argc, char **argv) {
parseOptions( app.arguments(), &options );
AccountPtr account = Account::create();
if( !account ) {
qFatal("Could not initialize account!");
return EXIT_FAILURE;
}
// check if the webDAV path was added to the url and append if not.
if(!options.target_url.endsWith("/")) {
options.target_url.append("/");
}
if( !options.target_url.contains( account->davPath() )) {
options.target_url.append(account->davPath());
}
if (options.target_url.startsWith("http"))
options.target_url.replace(0, 4, "owncloud");
QUrl url = QUrl::fromUserInput(options.target_url);
// Order of retrieval attempt (later attempts override earlier ones):
@ -331,8 +338,6 @@ int main(int argc, char **argv) {
// take the unmodified url to pass to csync_create()
QByteArray remUrl = options.target_url.toUtf8();
AccountPtr account = Account::create();
// Find the folder and the original owncloud url
QStringList splitted = url.path().split(account->davPath());
url.setPath(splitted.value(0));

View file

@ -26,6 +26,7 @@
#include "syncfileitem.h"
#include "filesystem.h"
#include "version.h"
#include "account.h"
#include "accountstate.h"
#include <QDebug>
@ -655,7 +656,7 @@ SyncFileStatus SocketApi::fileStatus(Folder *folder, const QString& systemFileNa
if (rec._remotePerm.isNull()) {
// probably owncloud 6, that does not have permissions flag yet.
QString url = folder->remoteUrl().toString() + fileName;
if (url.contains( Theme::instance()->webDavPath() + QLatin1String("Shared/") )) {
if (url.contains( folder->accountState()->account()->davPath() + QLatin1String("Shared/") )) {
status.setSharedWithMe(true);
}
} else if (rec._remotePerm.contains("S")) {

View file

@ -106,7 +106,7 @@ void OwncloudSetupPage::slotUrlChanged(const QString& url)
if (url.endsWith("index.php")) {
newUrl.chop(9);
}
QString webDavPath = Theme::instance()->webDavPath();
QString webDavPath = _ocWizard->account()->davPath();
if (url.endsWith(webDavPath)) {
newUrl.chop( webDavPath.length() );
}