mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
bug-fix: add attachment name check
This commit is contained in:
parent
04fa3654a4
commit
37058b04df
@ -378,6 +378,22 @@ void VAttachmentList::handleListItemCommitData(QWidget *p_itemEdit)
|
||||
return;
|
||||
}
|
||||
|
||||
bool legalName = true;
|
||||
if (text.isEmpty()) {
|
||||
legalName = false;
|
||||
} else {
|
||||
QRegExp reg(VUtils::c_fileNameRegExp);
|
||||
if (!reg.exactMatch(text)) {
|
||||
legalName = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!legalName) {
|
||||
// Recover to old name.
|
||||
item->setText(oldText);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(oldText.toLower() == text.toLower())
|
||||
&& m_file->findAttachment(text, false) > -1) {
|
||||
// Name conflict.
|
||||
|
Loading…
x
Reference in New Issue
Block a user