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
57ba0a2a
Commit
57ba0a2a
authored
Jun 14, 2012
by
btimby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A bit of cleanup, and default to using the underlying file mode.
parent
42e2c078
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
fs/expose/ftp.py
+13
-7
No files found.
fs/expose/ftp.py
View file @
57ba0a2a
...
@@ -143,22 +143,28 @@ class FTPFS(ftpserver.AbstractedFS):
...
@@ -143,22 +143,28 @@ class FTPFS(ftpserver.AbstractedFS):
kwargs
[
'st_uid'
]
=
info
.
get
(
'st_uid'
,
UID
)
kwargs
[
'st_uid'
]
=
info
.
get
(
'st_uid'
,
UID
)
kwargs
[
'st_gid'
]
=
info
.
get
(
'st_gid'
,
GID
)
kwargs
[
'st_gid'
]
=
info
.
get
(
'st_gid'
,
GID
)
if
'st_atime'
in
info
:
if
'st_atime'
in
info
:
kwargs
[
'st_atime'
]
=
info
.
get
(
'st_atime'
)
kwargs
[
'st_atime'
]
=
info
[
'st_atime'
]
elif
'accessed_time'
in
info
:
elif
'accessed_time'
in
info
:
kwargs
[
'st_atime'
]
=
time
.
mktime
(
info
.
get
(
"accessed_time"
)
.
timetuple
())
kwargs
[
'st_atime'
]
=
time
.
mktime
(
info
[
"accessed_time"
]
.
timetuple
())
if
'st_mtime'
in
info
:
if
'st_mtime'
in
info
:
kwargs
[
'st_mtime'
]
=
info
.
get
(
'st_mtime'
)
kwargs
[
'st_mtime'
]
=
info
.
get
(
'st_mtime'
)
elif
'modified_time'
in
info
:
elif
'modified_time'
in
info
:
kwargs
[
'st_mtime'
]
=
time
.
mktime
(
info
.
get
(
"modified_time"
)
.
timetuple
())
kwargs
[
'st_mtime'
]
=
time
.
mktime
(
info
[
"modified_time"
]
.
timetuple
())
# Pyftpdlib uses st_ctime on Windows platform, try to provide it.
# Pyftpdlib uses st_ctime on Windows platform, try to provide it.
if
'st_ctime'
in
info
:
if
'st_ctime'
in
info
:
kwargs
[
'st_ctime'
]
=
info
.
get
(
'st_ctime'
)
kwargs
[
'st_ctime'
]
=
info
[
'st_ctime'
]
elif
'created_time'
in
info
:
elif
'created_time'
in
info
:
kwargs
[
'st_ctime'
]
=
time
.
mktime
(
info
.
get
(
"created_time"
)
.
timetuple
())
kwargs
[
'st_ctime'
]
=
time
.
mktime
(
info
[
"created_time"
]
.
timetuple
())
elif
'st_mtime'
in
kwargs
:
elif
'st_mtime'
in
kwargs
:
# As a last resort, just copy the modified time.
# As a last resort, just copy the modified time.
kwargs
[
'st_ctime'
]
=
kwargs
[
'st_mtime'
]
kwargs
[
'st_ctime'
]
=
kwargs
[
'st_mtime'
]
# Not executable by default, Chrome uses the exec flag to denote directories.
# Try to use existing mode.
if
'st_mode'
in
info
:
kwargs
[
'st_mode'
]
=
info
[
'st_mode'
]
elif
'mode'
in
info
:
kwargs
[
'st_mode'
]
=
info
[
'mode'
]
else
:
# Otherwise, build one. Not executable by default.
mode
=
0660
mode
=
0660
# Merge in the type (dir or file). File is tested first, some file systems
# Merge in the type (dir or file). File is tested first, some file systems
# such as ArchiveMountFS treat archive files as directories too. By checking
# such as ArchiveMountFS treat archive files as directories too. By checking
...
@@ -167,7 +173,7 @@ class FTPFS(ftpserver.AbstractedFS):
...
@@ -167,7 +173,7 @@ class FTPFS(ftpserver.AbstractedFS):
mode
|=
stat
.
S_IFREG
mode
|=
stat
.
S_IFREG
elif
self
.
fs
.
isdir
(
path
):
elif
self
.
fs
.
isdir
(
path
):
mode
|=
stat
.
S_IFDIR
mode
|=
stat
.
S_IFDIR
mode
|=
0110
# Merge in exec bit
mode
|=
0110
# Merge in exec bit to signal dir is listable
kwargs
[
'st_mode'
]
=
mode
kwargs
[
'st_mode'
]
=
mode
return
FakeStat
(
**
kwargs
)
return
FakeStat
(
**
kwargs
)
...
...
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