Skip to content

Commit

Permalink
Added string manipulations to handle double quotes in tsv files, chan…
Browse files Browse the repository at this point in the history
…ged isPrimaryProjectImage to false when uploading documents
  • Loading branch information
per305 authored and per305 committed Feb 22, 2022
1 parent bb32685 commit f6083fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/RestClient/nesp/marineArtefacts/documentImport.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ for(var i = 1; i < csvRows.length; i++) {
}

if (fields[doiLink]) {
if (fields[doiLink].indexOf(',') != -1) {
if ((fields[doiLink].indexOf(',') != -1) || (fields[doiLink].indexOf('"') != -1)) {
var tempDoi = fields[doiLink].replace(/""/g, '"');
document.doiLink = tempDoi.substring(1, tempDoi.length - 1);
}
Expand All @@ -89,7 +89,7 @@ for(var i = 1; i < csvRows.length; i++) {
}

if (fields[role]) {
if (fields[role].indexOf(',') != -1) {
if ((fields[role].indexOf(',') != -1) || (fields[role].indexOf('"') != -1)) {

This comment has been minimized.

Copy link
@temi

temi Feb 22, 2022

Contributor

is this needed fields[role].indexOf(',') != -1)?

var tempType = fields[role].replace(/""/g, '"');
document.role = tempType.substring(1, tempType.length - 1);
}
Expand Down

0 comments on commit f6083fe

Please sign in to comment.