Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
minervaR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
minerva
minervaR
Merge requests
!60
final changes to ask_GET, zip files handled as text files
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
final changes to ask_GET, zip files handled as text files
Rcode
into
master
Overview
0
Commits
1
Pipelines
1
Changes
1
Merged
Marek Ostaszewski
requested to merge
Rcode
into
master
2 years ago
Overview
0
Commits
1
Pipelines
1
Changes
1
Expand
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
fb8f6e5c
1 commit,
2 years ago
1 file
+
6
−
3
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
R/connectors.R
+
6
−
3
Options
@@ -30,13 +30,16 @@ ask_GET <- function(api_call, token = NULL, ctype = NULL,
### when the content is sent as a zip file, it needs to be handled differently,
### i.e. saved to a tmp file and unzipped
if
(
httr
::
headers
(
resp
)
$
`content-type`
==
"application/zip"
)
{
### Create a temp file and save the zip content there
tmp
<-
tempfile
()
tmpc
<-
file
(
tmp
,
"wb"
)
writeBin
(
httr
::
content
(
resp
,
as
=
"raw"
),
con
=
tmpc
)
close
(
tmpc
)
unzipped
<-
utils
::
unzip
(
tmp
)
file.remove
(
tmp
)
return
(
unzipped
)
### Unzip the content and read it in to return it, clean temp files
utmp
<-
utils
::
unzip
(
tmp
)
ucontent
<-
readChar
(
utmp
,
file.info
(
utmp
)
$
size
)
file.remove
(
tmp
,
utmp
)
return
(
ucontent
)
}
else
{
return
(
httr
::
content
(
resp
,
as
=
"text"
,
encoding
=
encoding
))
}
Loading