Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Fiat Tux
Hat softwares
Lufi
Commits
6f3cf342
Commit
6f3cf342
authored
Jun 07, 2016
by
Luc Didry
Committed by
Luc Didry
Jul 24, 2016
Browse files
Fix
#36
parent
9cf06931
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/Lufi/Controller/Files.pm
View file @
6f3cf342
...
...
@@ -2,7 +2,7 @@
package
Lufi::Controller::
Files
;
use
Mojo::
Base
'
Mojolicious::Controller
';
use
Mojo::
JSON
qw(encode_json decode_json true false)
;
use
Mojo::
Util
qw(slurp spurt encode)
;
use
Mojo::
Util
qw(slurp spurt encode
decode
)
;
use
LufiDB
;
use
Lufi::
File
;
use
Lufi::
Slice
;
...
...
@@ -26,6 +26,7 @@ sub upload {
my
(
$json
)
=
split
('
XXMOJOXX
',
$text
,
2
);
$json
=
encode
'
UTF-8
',
$json
;
$text
=~
s/^.*?XXMOJOXX/${json}XXMOJOXX/
;
$json
=
decode_json
$json
;
$c
->
app
->
log
->
debug
('
Got message
');
...
...
@@ -179,6 +180,10 @@ sub download {
my
$e
=
$f
->
slices
->
[
$num
];
my
$text
=
slurp
$e
->
path
;
my
(
$json2
)
=
split
('
XXMOJOXX
',
$text
,
2
);
$json2
=
decode
'
UTF-8
',
$json2
;
$text
=~
s/^.*?XXMOJOXX/${json2}XXMOJOXX/
;
# Send the slice
$c
->
send
(
$text
);
}
elsif
(
defined
(
$json
->
{
ended
})
&&
$json
->
{
ended
})
{
...
...
Write
Preview
Supports
Markdown
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