Fix shortening of filenames containing surrogate pairs.
This commit is contained in:
parent
5844ad7943
commit
dda29feda1
@ -9,10 +9,9 @@ Build =
|
|||||||
{'&': '&', ''': "'", '"': '"', '<': '<', '>': '>', ',': ','}[c]
|
{'&': '&', ''': "'", '"': '"', '<': '<', '>': '>', ',': ','}[c]
|
||||||
|
|
||||||
shortFilename: (filename) ->
|
shortFilename: (filename) ->
|
||||||
threshold = 30
|
|
||||||
ext = filename.match(/\.?[^\.]*$/)[0]
|
ext = filename.match(/\.?[^\.]*$/)[0]
|
||||||
if filename.length - ext.length > threshold
|
if filename.length - ext.length > 30
|
||||||
"#{filename[...threshold - 5]}(...)#{ext}"
|
"#{filename.match(/(?:[\uD800-\uDBFF][\uDC00-\uDFFF]|[^]){0,25}/)[0]}(...)#{ext}"
|
||||||
else
|
else
|
||||||
filename
|
filename
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user