Skip to content

Commit

Permalink
fixes #147
Browse files Browse the repository at this point in the history
  • Loading branch information
nicklucius committed Dec 5, 2017
1 parent db5ecda commit 7b9ae5f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions R/RSocrata.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@ validateUrl <- function(url, app_token) {
parsedUrl$query <- NULL
}

# if /data appended to URL, remove it
pathLength <- nchar(parsedUrl$path)
if(substr(parsedUrl$path, pathLength - 4, pathLength) == '/data') {
parsedUrl$path <- substr(parsedUrl$path, 1, pathLength - 5)
}
if(substr(parsedUrl$path, pathLength - 5, pathLength) == '/data/') {
parsedUrl$path <- substr(parsedUrl$path, 1, pathLength - 6)
}


fourByFour <- basename(parsedUrl$path)
if(!isFourByFour(fourByFour))
stop(fourByFour, " is not a valid Socrata dataset unique identifier.")
Expand Down

0 comments on commit 7b9ae5f

Please sign in to comment.