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
aa
indexalist
Commits
e45ea23d
Commit
e45ea23d
authored
Dec 19, 2020
by
Michael Murtaugh
Browse files
utf-8 errors, urlencode use errors=replace
parent
220d9e83
Changes
1
Hide whitespace changes
Inline
Side-by-side
indexalist/data/templates/Sconstruct.py
View file @
e45ea23d
...
...
@@ -93,7 +93,7 @@ def make_folder_meta (target, source, env):
d
=
{}
d
[
'type'
]
=
"directory"
d
[
'filename'
]
=
os
.
path
.
split
(
path
)[
1
]
d
[
'id'
]
=
urlquote
(
d
[
'filename'
])
+
"/"
d
[
'id'
]
=
urlquote
(
d
[
'filename'
]
,
errors
=
"replace"
)
+
"/"
files
=
0
folders
=
0
total_bytes
=
0
...
...
@@ -139,7 +139,7 @@ def make_folder_meta (target, source, env):
total_files_by_ext
[
ext
]
=
{
'count'
:
0
,
'total_bytes'
:
0
}
total_files_by_ext
[
ext
][
'count'
]
+=
cdinfo
[
'total_files_by_ext'
][
ext
][
'count'
]
total_files_by_ext
[
ext
][
'total_bytes'
]
+=
cdinfo
[
'total_files_by_ext'
][
ext
][
'total_bytes'
]
cd
[
'link'
]
=
urlquote
(
os
.
path
.
relpath
(
src
.
path
,
path
))
cd
[
'link'
]
=
urlquote
(
os
.
path
.
relpath
(
src
.
path
,
path
)
,
errors
=
"replace"
)
cd_mtime_dt
=
None
if
'last_modification'
in
cdinfo
:
cd
[
'last_modification'
]
=
cdinfo
[
'last_modification'
]
...
...
@@ -152,7 +152,7 @@ def make_folder_meta (target, source, env):
cc
.
append
(
cd
)
cd
[
'type'
]
=
"file"
cd
[
'filename'
]
=
os
.
path
.
split
(
src
.
path
)[
1
]
cd
[
'id'
]
=
urlquote
(
cd
[
'filename'
])
cd
[
'id'
]
=
urlquote
(
cd
[
'filename'
]
,
errors
=
"replace"
)
contents_by_id
[
cd
[
'id'
]]
=
cd
cd_mtime_dt
=
datetime
.
datetime
.
fromtimestamp
(
os
.
stat
(
src
.
path
,
follow_symlinks
=
False
).
st_mtime
)
cd
[
'mtime'
]
=
cd_mtime_dt
.
isoformat
()
...
...
@@ -211,7 +211,7 @@ def ffmpeg_get_meta (target, source, env):
d
=
ffmpeg_get_info
(
source
[
0
].
path
)
d
[
'id'
]
=
urlquote
(
os
.
path
.
basename
(
source
[
0
].
path
),
errors
=
"replace"
)
def
relurl
(
x
):
return
urlquote
(
os
.
path
.
relpath
(
str
(
x
),
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
target
[
0
].
path
)))))
return
urlquote
(
os
.
path
.
relpath
(
str
(
x
),
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
target
[
0
].
path
))))
,
errors
=
"replace"
)
for
s
in
source
[
1
:]:
basename
=
os
.
path
.
basename
(
str
(
s
))
if
basename
==
"thumb.png"
:
...
...
@@ -275,9 +275,9 @@ ImageThumb = Builder(action=make_image_thumb)
def
make_image_meta
(
target
,
source
,
env
):
d
=
image_get_info
(
source
[
0
].
path
)
d
[
'id'
]
=
urlquote
(
os
.
path
.
basename
(
source
[
0
].
path
))
d
[
'id'
]
=
urlquote
(
os
.
path
.
basename
(
source
[
0
].
path
)
,
errors
=
"replace"
)
def
relurl
(
x
):
return
urlquote
(
os
.
path
.
relpath
(
str
(
x
),
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
target
[
0
].
path
)))))
return
urlquote
(
os
.
path
.
relpath
(
str
(
x
),
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
target
[
0
].
path
))))
,
errors
=
"replace"
)
for
s
in
source
[
1
:]:
basename
=
os
.
path
.
basename
(
str
(
s
))
if
basename
in
(
"thumb.jpg"
,
"thumb.png"
):
...
...
@@ -292,9 +292,9 @@ ImageMeta = Builder(action=make_image_meta)
def
make_pdf_meta
(
target
,
source
,
env
):
d
=
pdf_get_info
(
source
[
0
].
path
)
d
[
'id'
]
=
urlquote
(
os
.
path
.
basename
(
source
[
0
].
path
))
d
[
'id'
]
=
urlquote
(
os
.
path
.
basename
(
source
[
0
].
path
)
,
errors
=
"replace"
)
def
relurl
(
x
):
return
urlquote
(
os
.
path
.
relpath
(
str
(
x
),
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
target
[
0
].
path
)))))
return
urlquote
(
os
.
path
.
relpath
(
str
(
x
),
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
target
[
0
].
path
))))
,
errors
=
"replace"
)
for
s
in
source
[
1
:]:
basename
=
os
.
path
.
basename
(
str
(
s
))
if
basename
in
(
"thumb.jpg"
,
"thumb.png"
):
...
...
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