Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
04d390a6
authored
Feb 25, 2013
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
store: use shutil.make_archive for archiving
fixes #69
parent
7a77678d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
15 deletions
+5
-15
miscellaneous/store-server/CloudStore.py
+5
-15
No files found.
miscellaneous/store-server/CloudStore.py
View file @
04d390a6
...
@@ -100,23 +100,13 @@ def cmd_download(request, neptun, home_path):
...
@@ -100,23 +100,13 @@ def cmd_download(request, neptun, home_path):
if
not
dl_path
.
startswith
(
home_path
):
if
not
dl_path
.
startswith
(
home_path
):
abort
(
400
,
'Invalid download path.'
)
abort
(
400
,
'Invalid download path.'
)
dl_hash
=
str
(
uuid
.
uuid4
())
dl_hash
=
str
(
uuid
.
uuid4
())
if
(
os
.
path
.
isfile
(
dl_path
)
):
dl_pub
=
os
.
path
.
join
(
ROOT_WWW_FOLDER
,
dl_hash
)
os
.
symlink
(
dl_path
,
ROOT_WWW_FOLDER
+
'/'
+
dl_hash
)
if
os
.
path
.
isfile
(
dl_path
):
# Debug
os
.
symlink
(
dl_path
,
dl_pub
)
# redirect('http://store.cloud.ik.bme.hu:8080/dl/'+dl_hash)
return
json
.
dumps
({
'LINK'
:
SITE_URL
+
'/dl/'
+
dl_hash
})
return
json
.
dumps
({
'LINK'
:
SITE_URL
+
'/dl/'
+
dl_hash
})
else
:
else
:
try
:
shutil
.
make_archive
(
dl_pub
,
'zip'
,
dl_path
)
os
.
makedirs
(
TEMP_DIR
+
'/'
+
neptun
,
0700
)
return
json
.
dumps
({
'LINK'
:
SITE_URL
+
'/dl/'
+
dl_hash
+
'.zip'
})
except
:
pass
folder_name
=
os
.
path
.
basename
(
dl_path
)
temp_path
=
TEMP_DIR
+
'/'
+
neptun
+
'/'
+
folder_name
+
'.zip'
with
open
(
os
.
devnull
,
"w"
)
as
fnull
:
# zip -rqDj vmi.zip /home/tarokkk/vpn-ik
result
=
subprocess
.
call
([
'/usr/bin/zip'
,
'-rqDj'
,
temp_path
,
dl_path
],
stdout
=
fnull
,
stderr
=
fnull
)
os
.
symlink
(
temp_path
,
ROOT_WWW_FOLDER
+
'/'
+
dl_hash
)
return
json
.
dumps
({
'LINK'
:
SITE_URL
+
'/dl/'
+
dl_hash
})
COMMANDS
[
'DOWNLOAD'
]
=
cmd_download
COMMANDS
[
'DOWNLOAD'
]
=
cmd_download
# UPLOAD
# UPLOAD
...
...
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