Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
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
Hide 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):
if
not
dl_path
.
startswith
(
home_path
):
abort
(
400
,
'Invalid download path.'
)
dl_hash
=
str
(
uuid
.
uuid4
())
if
(
os
.
path
.
isfile
(
dl_path
)
):
os
.
symlink
(
dl_path
,
ROOT_WWW_FOLDER
+
'/'
+
dl_hash
)
# Debug
# redirect('http://store.cloud.ik.bme.hu:8080/dl/'+dl_hash)
dl_pub
=
os
.
path
.
join
(
ROOT_WWW_FOLDER
,
dl_hash
)
if
os
.
path
.
isfile
(
dl_path
):
os
.
symlink
(
dl_path
,
dl_pub
)
return
json
.
dumps
({
'LINK'
:
SITE_URL
+
'/dl/'
+
dl_hash
})
else
:
try
:
os
.
makedirs
(
TEMP_DIR
+
'/'
+
neptun
,
0700
)
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
})
shutil
.
make_archive
(
dl_pub
,
'zip'
,
dl_path
)
return
json
.
dumps
({
'LINK'
:
SITE_URL
+
'/dl/'
+
dl_hash
+
'.zip'
})
COMMANDS
[
'DOWNLOAD'
]
=
cmd_download
# 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