Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Przemyslaw Kaminski
haskell-gargantext
Commits
12c2beae
Commit
12c2beae
authored
Oct 11, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[corpus] attempt to implement zip as base-64 encoded file
parent
3f8a8c0e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
3 deletions
+10
-3
New.hs
src/Gargantext/API/Node/Corpus/New.hs
+8
-1
Types.hs
src/Gargantext/API/Node/Types.hs
+1
-1
stack.yaml
stack.yaml
+1
-1
No files found.
src/Gargantext/API/Node/Corpus/New.hs
View file @
12c2beae
...
...
@@ -21,6 +21,7 @@ module Gargantext.API.Node.Corpus.New
import
Control.Lens
hiding
(
elements
,
Empty
)
import
Data.Aeson
import
Data.Aeson.TH
(
deriveJSON
)
import
qualified
Data.ByteString.Base64
as
BSB64
import
Data.Either
import
Data.Maybe
(
fromMaybe
)
import
Data.Swagger
...
...
@@ -32,6 +33,7 @@ import Protolude (readFile)
import
Servant
import
Servant.Job.Utils
(
jsonOptions
)
-- import Servant.Multipart
import
qualified
Data.Text.Encoding
as
TE
-- import Test.QuickCheck (elements)
import
Test.QuickCheck.Arbitrary
...
...
@@ -260,7 +262,12 @@ addToCorpusWithForm user cid (NewWithForm ft d l _n) logStatus jobLog = do
ZIP
->
Parser
.
parseFormat
Parser
.
ZIP
-- TODO granularity of the logStatus
eDocs
<-
liftBase
$
parse
$
cs
d
let
data
'
=
case
ft
of
ZIP
->
case
BSB64
.
decode
$
TE
.
encodeUtf8
d
of
Left
err
->
panic
$
T
.
pack
"[addToCorpusWithForm] error decoding base64"
err
Right
decoded
->
decoded
_
->
cs
d
eDocs
<-
liftBase
$
parse
data
'
case
eDocs
of
Right
docs'
->
do
let
docs
=
splitEvery
500
$
take
1000000
docs'
...
...
src/Gargantext/API/Node/Types.hs
View file @
12c2beae
...
...
@@ -24,7 +24,7 @@ import Gargantext.API.Node.Corpus.New.File (FileType)
-------------------------------------------------------
data
NewWithForm
=
NewWithForm
{
_wf_filetype
::
!
FileType
,
_wf_data
::
!
Text
,
_wf_data
::
!
Text
-- NOTE for binary files, this represents base-64 data
,
_wf_lang
::
!
(
Maybe
Lang
)
,
_wf_name
::
!
Text
}
deriving
(
Eq
,
Show
,
Generic
)
...
...
stack.yaml
View file @
12c2beae
...
...
@@ -10,7 +10,7 @@ packages:
#- 'deps/accelerate-utility'
docker
:
enable
:
false
#
enable: false
#enable: true
repo
:
'
cgenie/stack-build:lts-18.12-garg'
run-args
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment