dbhub: Only provide commit id when pushing when the database is a clone

When pushing a database to the remote server only provide the commit id
when the database file is saved in the directory of cloned databases.
This makes sure we do not provide any random commit id when a database
with the same name as a cloned database is pushed.

See issue #1164.
This commit is contained in:
Martin Kleusberg
2020-07-15 11:49:44 +02:00
parent 062822d3b2
commit 780542e784
+4 -1
View File
@@ -583,10 +583,13 @@ void RemoteDatabase::push(const QString& filename, const QString& url, const QSt
addPart(multipart, "licence", licence);
addPart(multipart, "public", isPublic ? "true" : "false");
addPart(multipart, "branch", branch);
addPart(multipart, "commit", QString::fromStdString(localLastCommitId(clientCert, url, branch.toStdString())));
addPart(multipart, "force", forcePush ? "true" : "false");
addPart(multipart, "lastmodified", last_modified.toString("yyyy-MM-dd'T'HH:mm:ss'Z'"));
// Only add commit id if the pushed file is actually a cloned file
if(filename.startsWith(Settings::getValue("remote", "clonedirectory").toString()))
addPart(multipart, "commit", QString::fromStdString(localLastCommitId(clientCert, url, branch.toStdString())));
// Set SSL configuration when trying to access a file via the HTTPS protocol
bool https = QUrl(url).scheme().compare("https", Qt::CaseInsensitive) == 0;
if(https)