]> dgit.raspbian.org Git - nextcloud-desktop.git/commitdiff
Fix MacOS UTF-8 normalization issue
authorxavi-b <developer@xavi-b.fr>
Mon, 19 Sep 2022 22:21:11 +0000 (00:21 +0200)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Sun, 23 Apr 2023 16:52:17 +0000 (00:52 +0800)
Signed-off-by: xavi-b <developer@xavi-b.fr>
src/common/syncjournaldb.cpp

index fed825794a336a0d2528411ab02b71d41bb5eaf4..23e33c16999c395dce317a36e9b0119b0055e16e 100644 (file)
@@ -882,10 +882,15 @@ QVector<QByteArray> SyncJournalDb::tableColumns(const QByteArray &table)
 
 qint64 SyncJournalDb::getPHash(const QByteArray &file)
 {
+    QByteArray bytes = file;
+#ifdef Q_OS_MAC
+    bytes = QString::fromUtf8(file).normalized(QString::NormalizationForm_C).toUtf8();
+#endif
+
     qint64 h = 0;
-    int len = file.length();
+    int len = bytes.length();
 
-    h = c_jhash64((uint8_t *)file.data(), len, 0);
+    h = c_jhash64((uint8_t *)bytes.data(), len, 0);
     return h;
 }