Skip to content

Commit

Permalink
Prevent duplicate URLs from being added (stashapp#437)
Browse files Browse the repository at this point in the history
  • Loading branch information
peolic authored and feederbox826 committed Nov 15, 2023
1 parent 23b9f33 commit 0ba2054
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions frontend/src/components/urlInput/urlInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@ const URLInput: FC<URLInputProps> = ({ control, type, errors }) => {
if (!newURL || !selectedSite) return;
const cleanedURL = cleanURL(selectedSite?.regex, newURL);

append({
url: cleanedURL ?? newURL,
site: selectedSite,
});
const url = cleanedURL ?? newURL;
if (!urls.some((u) => u.url === url))
append({
url,
site: selectedSite,
});

if (selectRef.current) selectRef.current.value = "";
if (inputRef.current) inputRef.current.value = "";
Expand Down

0 comments on commit 0ba2054

Please sign in to comment.