Skip to content
This repository has been archived by the owner on May 20, 2020. It is now read-only.

Commit

Permalink
final corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
GaurangTandon committed Jun 24, 2019
1 parent cdb8271 commit 7d5a404
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion html/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ <h2>&#x25cf; Functional changes</h2>
<a target="_blank" href="https://www.paypal.me/GaurangTandon">Donate money!</a>
</div>
</div>
</div>
</div>

<div class="no-db-error box large-box">
<p class="heading">Oops, there's an error!</p>
Expand Down
4 changes: 3 additions & 1 deletion js/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,9 @@ These editors are generally found in your email client like Gmail, Outlook, etc.
// an HTML element
reader.addEventListener("load", (event) => {
const importFileData = event.target.result;
console.log("Data got", importFileData);
console.log("Data got\n", importFileData);
window.Data = {};
Data.snippets = new Folder(Folder.MAIN_SNIPPETS_NAME);
initiateRestore(importFileData, Data.snippets, true);
});

Expand Down
12 changes: 9 additions & 3 deletions js/snippetClasses.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,15 @@ Generic.isValidName = function (name, type) {
return `Name cannot be greater than ${OBJECT_NAME_LIMIT} characters. Current name has ${name.length
- OBJECT_NAME_LIMIT} more characters.`;
}
return Data.snippets.getUniqueObject(name, type)
? Generic.getDuplicateObjectsText(name, type)
: "true";

// error may occur during no-db-restore
try {
const dupeExists = Data.snippets.getUniqueObject(name, type);
if (dupeExists) { return Generic.getDuplicateObjectsText(name, type); }
return "true";
} catch (e) {
return "true";
}
};

/**
Expand Down

0 comments on commit 7d5a404

Please sign in to comment.