Commit 976c5331a5958e393e307d2bcd0ccd6b55ca705f
1 parent
30f8fe2e
Don't overwrite pre-existing Partition metadata in galleries
Showing
1 changed file
with
6 additions
and
4 deletions
openbr/openbr_plugin.cpp
| ... | ... | @@ -452,10 +452,12 @@ TemplateList TemplateList::fromGallery(const br::File &gallery) |
| 452 | 452 | // of target images to every partition |
| 453 | 453 | newTemplates[i].file.set("Partition", -1); |
| 454 | 454 | } else { |
| 455 | - // Direct use of "Label" is not general -cao | |
| 456 | - const QByteArray md5 = QCryptographicHash::hash(newTemplates[i].file.get<QString>("Label").toLatin1(), QCryptographicHash::Md5); | |
| 457 | - // Select the right 8 hex characters so that it can be represented as a 64 bit integer without overflow | |
| 458 | - newTemplates[i].file.set("Partition", md5.toHex().right(8).toULongLong(0, 16) % crossValidate); | |
| 455 | + if (!newTemplates[i].file.contains(("Partition"))) { | |
| 456 | + // Direct use of "Label" is not general -cao | |
| 457 | + const QByteArray md5 = QCryptographicHash::hash(newTemplates[i].file.get<QString>("Label").toLatin1(), QCryptographicHash::Md5); | |
| 458 | + // Select the right 8 hex characters so that it can be represented as a 64 bit integer without overflow | |
| 459 | + newTemplates[i].file.set("Partition", md5.toHex().right(8).toULongLong(0, 16) % crossValidate); | |
| 460 | + } | |
| 459 | 461 | } |
| 460 | 462 | } |
| 461 | 463 | } | ... | ... |