Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pyfs
Overview
Overview
Details
Activity
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
OpenEdx
pyfs
Commits
8ed5d5d8
Commit
8ed5d5d8
authored
Mar 11, 2011
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix some malformed XML in DAVFS
parent
86038e88
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
9 deletions
+13
-9
fs/contrib/davfs/__init__.py
+10
-7
fs/s3fs.py
+3
-2
No files found.
fs/contrib/davfs/__init__.py
View file @
8ed5d5d8
...
@@ -166,7 +166,10 @@ class DAVFS(FS):
...
@@ -166,7 +166,10 @@ class DAVFS(FS):
"""Convert a server-side URL into a client-side path."""
"""Convert a server-side URL into a client-side path."""
path
=
urlunquote
(
urlparse
(
url
)
.
path
)
path
=
urlunquote
(
urlparse
(
url
)
.
path
)
root
=
self
.
_url_p
.
path
root
=
self
.
_url_p
.
path
return
path
[
len
(
root
)
-
1
:]
.
decode
(
"utf8"
)
path
=
path
[
len
(
root
)
-
1
:]
.
decode
(
"utf8"
)
while
path
.
endswith
(
"/"
):
path
=
path
[:
-
1
]
return
path
def
_isurl
(
self
,
path
,
url
):
def
_isurl
(
self
,
path
,
url
):
"""Check whether the given URL corresponds to the given local path."""
"""Check whether the given URL corresponds to the given local path."""
...
@@ -187,7 +190,7 @@ class DAVFS(FS):
...
@@ -187,7 +190,7 @@ class DAVFS(FS):
resp
=
self
.
_raw_request
(
url
,
method
,
body
,
headers
)
resp
=
self
.
_raw_request
(
url
,
method
,
body
,
headers
)
# Loop to retry for redirects and authentication responses.
# Loop to retry for redirects and authentication responses.
while
resp
.
status
in
(
301
,
302
,
401
,
403
):
while
resp
.
status
in
(
301
,
302
,
401
,
403
):
resp
.
close
()
#
resp.close()
if
resp
.
status
in
(
301
,
302
,):
if
resp
.
status
in
(
301
,
302
,):
visited
.
append
(
url
)
visited
.
append
(
url
)
url
=
resp
.
getheader
(
"Location"
,
None
)
url
=
resp
.
getheader
(
"Location"
,
None
)
...
@@ -549,7 +552,7 @@ class DAVFS(FS):
...
@@ -549,7 +552,7 @@ class DAVFS(FS):
If the server is able to send responses in chunked encoding, then
If the server is able to send responses in chunked encoding, then
this can substantially speed up iterating over the results.
this can substantially speed up iterating over the results.
"""
"""
pf
=
propfind
(
prop
=
"<
prop xmlns:D='DAV:'>"
+
props
+
"</
prop>"
)
pf
=
propfind
(
prop
=
"<
D:prop xmlns:D='DAV:'>"
+
props
+
"</D:
prop>"
)
response
=
self
.
_request
(
path
,
"PROPFIND"
,
pf
.
render
(),{
"Depth"
:
"1"
})
response
=
self
.
_request
(
path
,
"PROPFIND"
,
pf
.
render
(),{
"Depth"
:
"1"
})
try
:
try
:
if
response
.
status
==
404
:
if
response
.
status
==
404
:
...
@@ -670,9 +673,9 @@ class DAVFS(FS):
...
@@ -670,9 +673,9 @@ class DAVFS(FS):
(
namespaceURI
,
localName
)
=
self
.
_split_xattr
(
name
)
(
namespaceURI
,
localName
)
=
self
.
_split_xattr
(
name
)
# TODO: encode xml character entities in the namespace
# TODO: encode xml character entities in the namespace
if
namespaceURI
:
if
namespaceURI
:
pf
=
propfind
(
prop
=
"<
prop xmlns='"
+
namespaceURI
+
"'><"
+
localName
+
" /></
prop>"
)
pf
=
propfind
(
prop
=
"<
D:prop xmlns:D='DAV:' xmlns='"
+
namespaceURI
+
"'><"
+
localName
+
" /></D:
prop>"
)
else
:
else
:
pf
=
propfind
(
prop
=
"<
prop><"
+
localName
+
" /></
prop>"
)
pf
=
propfind
(
prop
=
"<
D:prop xmlns:D='DAV:'><"
+
localName
+
" /></D:
prop>"
)
response
=
self
.
_request
(
path
,
"PROPFIND"
,
pf
.
render
(),{
"Depth"
:
"0"
})
response
=
self
.
_request
(
path
,
"PROPFIND"
,
pf
.
render
(),{
"Depth"
:
"0"
})
try
:
try
:
if
response
.
status
!=
207
:
if
response
.
status
!=
207
:
...
@@ -706,7 +709,7 @@ class DAVFS(FS):
...
@@ -706,7 +709,7 @@ class DAVFS(FS):
else
:
else
:
p
=
"<
%
s>
%
s</
%
s>"
%
(
localName
,
value
,
localName
)
p
=
"<
%
s>
%
s</
%
s>"
%
(
localName
,
value
,
localName
)
pu
=
propertyupdate
()
pu
=
propertyupdate
()
pu
.
commands
.
append
(
set
(
props
=
"<
prop>"
+
p
+
"</
prop>"
))
pu
.
commands
.
append
(
set
(
props
=
"<
D:prop xmlns:D='DAV:'>"
+
p
+
"</D:
prop>"
))
response
=
self
.
_request
(
path
,
"PROPPATCH"
,
pu
.
render
(),{
"Depth"
:
"0"
})
response
=
self
.
_request
(
path
,
"PROPPATCH"
,
pu
.
render
(),{
"Depth"
:
"0"
})
response
.
close
()
response
.
close
()
if
response
.
status
<
200
or
response
.
status
>=
300
:
if
response
.
status
<
200
or
response
.
status
>=
300
:
...
@@ -720,7 +723,7 @@ class DAVFS(FS):
...
@@ -720,7 +723,7 @@ class DAVFS(FS):
else
:
else
:
p
=
"<
%
s />"
%
(
localName
,)
p
=
"<
%
s />"
%
(
localName
,)
pu
=
propertyupdate
()
pu
=
propertyupdate
()
pu
.
commands
.
append
(
remove
(
props
=
"<
prop>"
+
p
+
"</
prop>"
))
pu
.
commands
.
append
(
remove
(
props
=
"<
D:prop xmlns:D='DAV:'>"
+
p
+
"</D:
prop>"
))
response
=
self
.
_request
(
path
,
"PROPPATCH"
,
pu
.
render
(),{
"Depth"
:
"0"
})
response
=
self
.
_request
(
path
,
"PROPPATCH"
,
pu
.
render
(),{
"Depth"
:
"0"
})
response
.
close
()
response
.
close
()
if
response
.
status
<
200
or
response
.
status
>=
300
:
if
response
.
status
<
200
or
response
.
status
>=
300
:
...
...
fs/s3fs.py
View file @
8ed5d5d8
...
@@ -215,8 +215,9 @@ class S3FS(FS):
...
@@ -215,8 +215,9 @@ class S3FS(FS):
tf
.
write
(
data
)
tf
.
write
(
data
)
data
=
contents
.
read
(
524288
)
data
=
contents
.
read
(
524288
)
tf
.
seek
(
0
)
tf
.
seek
(
0
)
contents
=
tf
key
.
set_contents_from_file
(
tf
)
key
.
set_contents_from_file
(
contents
)
else
:
key
.
set_contents_from_file
(
contents
)
return
self
.
_sync_key
(
key
)
return
self
.
_sync_key
(
key
)
def
makepublic
(
self
,
path
):
def
makepublic
(
self
,
path
):
...
...
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