Skip to content

Commit

Permalink
upload_file fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mhpob committed Sep 13, 2023
1 parent a6d8a2a commit 1f93f77
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: matos
Type: Package
Title: Interface with the Mid-Atlantic Acoustic Telemetry Observing System (MATOS)
Version: 0.3.002
Version: 0.3.003
Authors@R: person("Michael", "O'Brien", email = "mike@obrien.page",
role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-1420-6395"))
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# matos 0.3.003
- Fix [`upload_file`](https://matos.obrien.page/reference/upload_file.html) to actually allow multiple uploads

# matos 0.3

- The meat of what were `make_tag_push_summary` and `make_receiver_push_summary` have been moved over to a new package: [`otndo`](https://otndo.obrien.page). These functions now wrap those in `otndo` and have been renamed [`matos_tag_summary`](https://matos.obrien.page/reference/matos_tag_summary.html) and [`matos_receiver_summary`](https://matos.obrien.page/reference/matos_receiver_summary.html), respectively.
Expand Down
6 changes: 3 additions & 3 deletions R/upload_file.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,21 +80,21 @@ upload_file <- function(project, file,
}

## Check that file extensions match the expected file type.
if(data_type %in% c('receivers', 'new_tags', 'glider') &&
if(any(data_type %in% c('receivers', 'new_tags', 'glider')) &&
any(grepl('xls|csv', file_extension) == F)){

stop(paste0('File is not saved as the correct type: should be CSV, XLS, or XLSX. Namely:\n\n',
paste(file[!grepl('xls|csv', file_extension)],
collapse = '\n')))

} else if(grepl('detections', data_type) &&
} else if(any(grepl('detections', data_type)) &&
any(grepl('vrl|csv', file_extension) == F)){

stop(paste0('File is not the correct type: should be VRL or CSV. Namely:\n\n',
paste(file[!grepl('vrl|csv', file_extension)],
collapse = '\n')))

} else if(data_type %in% c('events', 'gps') &&
} else if(any(data_type %in% c('events', 'gps')) &&
any(file_extension != 'csv')){

stop(paste0('File is not saved as the correct type: should be CSV. Namely:\n\n',
Expand Down

0 comments on commit 1f93f77

Please sign in to comment.