Skip to content

Commit

Permalink
Merge pull request #6 from FalveyLibraryTechnology/uri-regex-check
Browse files Browse the repository at this point in the history
Uri regex check
  • Loading branch information
edsilv authored Feb 14, 2018
2 parents 724b667 + 48a1e38 commit 88c759d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/MetadataComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ namespace IIIFComponents {

const originalLabel: string | null = item.getLabel();
let label: string | null = originalLabel;
var urlPattern = new RegExp("/\w+:(\/?\/?)[^\s]+/gm", "i");

if (label && item.isRootLevel) {
switch (label.toLowerCase()) {
Expand Down Expand Up @@ -348,7 +349,7 @@ namespace IIIFComponents {
let $value: JQuery;

// if the value is a URI
if (originalLabel && originalLabel.toLowerCase() === "license") {
if (originalLabel && originalLabel.toLowerCase() === "license" && (urlPattern.exec(item.value[0].value) != null)) {
$value = this._buildMetadataItemURIValue(item.value[0].value);
$values.append($value);
} else {
Expand Down

0 comments on commit 88c759d

Please sign in to comment.