mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 23:28:14 +03:00
Merge pull request #2925 from nextcloud/fix-incorrect-logger-output-for-non-latin-strings
Fix incorrect logger output for non-Latin strings.
This commit is contained in:
commit
e6ec648e3b
8 changed files with 21 additions and 11 deletions
|
@ -152,6 +152,12 @@ public:
|
|||
bindValueInternal(pos, value);
|
||||
}
|
||||
|
||||
void bindValue(int pos, const QByteArray &value)
|
||||
{
|
||||
qCDebug(lcSql) << "SQL bind" << pos << QString::fromUtf8(value);
|
||||
bindValueInternal(pos, value);
|
||||
}
|
||||
|
||||
const QByteArray &lastQuery() const;
|
||||
int numRowsAffected();
|
||||
void reset_and_clear_bindings();
|
||||
|
|
|
@ -909,11 +909,11 @@ bool SyncJournalDb::setFileRecord(const SyncJournalFileRecord &_record)
|
|||
}
|
||||
}
|
||||
|
||||
qCInfo(lcDb) << "Updating file record for path:" << record._path << "inode:" << record._inode
|
||||
qCInfo(lcDb) << "Updating file record for path:" << record.path() << "inode:" << record._inode
|
||||
<< "modtime:" << record._modtime << "type:" << record._type
|
||||
<< "etag:" << record._etag << "fileId:" << record._fileId << "remotePerm:" << record._remotePerm.toString()
|
||||
<< "fileSize:" << record._fileSize << "checksum:" << record._checksumHeader
|
||||
<< "e2eMangledName:" << record._e2eMangledName << "isE2eEncrypted:" << record._isE2eEncrypted;
|
||||
<< "e2eMangledName:" << record.e2eMangledName() << "isE2eEncrypted:" << record._isE2eEncrypted;
|
||||
|
||||
qlonglong phash = getPHash(record._path);
|
||||
if (checkConnect()) {
|
||||
|
@ -1241,7 +1241,7 @@ bool SyncJournalDb::listFilesInPath(const QByteArray& path,
|
|||
SyncJournalFileRecord rec;
|
||||
fillFileRecordFromGetQuery(rec, _listFilesInPathQuery);
|
||||
if (!rec._path.startsWith(path) || rec._path.indexOf("/", path.size() + 1) > 0) {
|
||||
qWarning(lcDb) << "hash collision" << path << rec._path;
|
||||
qWarning(lcDb) << "hash collision" << path << rec.path();
|
||||
continue;
|
||||
}
|
||||
rowCallback(rec);
|
||||
|
|
|
@ -55,6 +55,8 @@ public:
|
|||
bool isDirectory() const { return _type == ItemTypeDirectory; }
|
||||
bool isFile() const { return _type == ItemTypeFile || _type == ItemTypeVirtualFileDehydration; }
|
||||
bool isVirtualFile() const { return _type == ItemTypeVirtualFile || _type == ItemTypeVirtualFileDownload; }
|
||||
QString path() const { return QString::fromUtf8(_path); }
|
||||
QString e2eMangledName() const { return QString::fromUtf8(_e2eMangledName); }
|
||||
|
||||
QByteArray _path;
|
||||
quint64 _inode = 0;
|
||||
|
|
|
@ -319,7 +319,7 @@ void ProcessDirectoryJob::processFile(PathTuple path,
|
|||
<< " | inode: " << dbEntry._inode << "/" << localEntry.inode << "/"
|
||||
<< " | type: " << dbEntry._type << "/" << localEntry.type << "/" << (serverEntry.isDirectory ? ItemTypeDirectory : ItemTypeFile)
|
||||
<< " | e2ee: " << dbEntry._isE2eEncrypted << "/" << serverEntry.isE2eEncrypted
|
||||
<< " | e2eeMangledName: " << dbEntry._e2eMangledName << "/" << serverEntry.e2eMangledName;
|
||||
<< " | e2eeMangledName: " << dbEntry.e2eMangledName() << "/" << serverEntry.e2eMangledName;
|
||||
|
||||
if (_discoveryData->isRenamed(path._original)) {
|
||||
qCDebug(lcDisco) << "Ignoring renamed";
|
||||
|
@ -564,7 +564,7 @@ void ProcessDirectoryJob::processFileAnalyzeRemoteInfo(
|
|||
}
|
||||
|
||||
// Now we know there is a sane rename candidate.
|
||||
QString originalPath = QString::fromUtf8(base._path);
|
||||
QString originalPath = base.path();
|
||||
|
||||
if (_discoveryData->isRenamed(originalPath)) {
|
||||
qCInfo(lcDisco, "folder already has a rename entry, skipping");
|
||||
|
@ -896,7 +896,7 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo(
|
|||
dbError();
|
||||
return;
|
||||
}
|
||||
const auto originalPath = QString::fromUtf8(base._path);
|
||||
const auto originalPath = base.path();
|
||||
|
||||
// Function to gradually check conditions for accepting a move-candidate
|
||||
auto moveCheck = [&]() {
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <QDir>
|
||||
#include <QStringList>
|
||||
#include <QtGlobal>
|
||||
#include <QTextCodec>
|
||||
#include <qmetaobject.h>
|
||||
|
||||
#include <iostream>
|
||||
|
@ -198,6 +199,7 @@ void Logger::setLogFile(const QString &name)
|
|||
}
|
||||
|
||||
_logstream.reset(new QTextStream(&_logFile));
|
||||
_logstream->setCodec(QTextCodec::codecForName("UTF-8"));
|
||||
}
|
||||
|
||||
void Logger::setLogExpire(int expire)
|
||||
|
|
|
@ -989,14 +989,14 @@ void SyncEngine::wipeVirtualFiles(const QString &localPath, SyncJournalDb &journ
|
|||
if (rec._type != ItemTypeVirtualFile && rec._type != ItemTypeVirtualFileDownload)
|
||||
return;
|
||||
|
||||
qCDebug(lcEngine) << "Removing db record for" << rec._path;
|
||||
qCDebug(lcEngine) << "Removing db record for" << rec.path();
|
||||
journal.deleteFileRecord(rec._path);
|
||||
|
||||
// If the local file is a dehydrated placeholder, wipe it too.
|
||||
// Otherwise leave it to allow the next sync to have a new-new conflict.
|
||||
QString localFile = localPath + rec._path;
|
||||
if (QFile::exists(localFile) && vfs.isDehydratedPlaceholder(localFile)) {
|
||||
qCDebug(lcEngine) << "Removing local dehydrated placeholder" << rec._path;
|
||||
qCDebug(lcEngine) << "Removing local dehydrated placeholder" << rec.path();
|
||||
QFile::remove(localFile);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -63,7 +63,7 @@ SyncJournalFileRecord SyncFileItem::toSyncJournalFileRecordWithInode(const QStri
|
|||
SyncFileItemPtr SyncFileItem::fromSyncJournalFileRecord(const SyncJournalFileRecord &rec)
|
||||
{
|
||||
auto item = SyncFileItemPtr::create();
|
||||
item->_file = QString::fromUtf8(rec._path);
|
||||
item->_file = rec.path();
|
||||
item->_inode = rec._inode;
|
||||
item->_modtime = rec._modtime;
|
||||
item->_type = rec._type;
|
||||
|
@ -73,7 +73,7 @@ SyncFileItemPtr SyncFileItem::fromSyncJournalFileRecord(const SyncJournalFileRec
|
|||
item->_remotePerm = rec._remotePerm;
|
||||
item->_serverHasIgnoredFiles = rec._serverHasIgnoredFiles;
|
||||
item->_checksumHeader = rec._checksumHeader;
|
||||
item->_encryptedFileName = QString::fromUtf8(rec._e2eMangledName);
|
||||
item->_encryptedFileName = rec.e2eMangledName();
|
||||
item->_isEncrypted = rec._isE2eEncrypted;
|
||||
return item;
|
||||
}
|
||||
|
|
|
@ -995,7 +995,7 @@ FileInfo FakeFolder::dbState() const
|
|||
{
|
||||
FileInfo result;
|
||||
_journalDb->getFilesBelowPath("", [&](const OCC::SyncJournalFileRecord &record) {
|
||||
auto components = PathComponents(QString::fromUtf8(record._path));
|
||||
auto components = PathComponents(record.path());
|
||||
auto &parentDir = findOrCreateDirs(result, components.parentDirComponents());
|
||||
auto name = components.fileName();
|
||||
auto &item = parentDir.children[name];
|
||||
|
|
Loading…
Reference in a new issue