Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
funkwhale
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
gordon
funkwhale
Commits
79f9dae5
Commit
79f9dae5
authored
6 years ago
by
Eliot Berriot
Browse files
Options
Downloads
Plain Diff
Merge branch '138-surrogate-error-handling' into 'develop'
Resolve "Importer chokes on files with bad unicode characters" Closes
#138
See merge request
!309
parents
03eb2be2
252aa31b
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/funkwhale_api/providers/audiofile/management/commands/import_files.py
+22
-1
22 additions, 1 deletion
...i/providers/audiofile/management/commands/import_files.py
changes/changelog.d/138.bugfix
+1
-0
1 addition, 0 deletions
changes/changelog.d/138.bugfix
with
23 additions
and
1 deletion
api/funkwhale_api/providers/audiofile/management/commands/import_files.py
+
22
−
1
View file @
79f9dae5
...
...
@@ -82,10 +82,31 @@ class Command(BaseCommand):
try
:
for
import_path
in
options
[
"
path
"
]:
matching
+=
glob
.
glob
(
import_path
,
**
glob_kwargs
)
matching
=
sorted
(
list
(
set
(
matching
)))
raw_
matching
=
sorted
(
list
(
set
(
matching
)))
except
TypeError
:
raise
Exception
(
"
You need Python 3.5 to use the --recursive flag
"
)
matching
=
[]
for
m
in
raw_matching
:
# In some situations, the path is encoded incorrectly on the filesystem
# so we filter out faulty paths and display a warning to the user.
# see https://code.eliotberriot.com/funkwhale/funkwhale/issues/138
try
:
m
.
encode
(
"
utf-8
"
)
matching
.
append
(
m
)
except
UnicodeEncodeError
:
try
:
previous
=
matching
[
-
1
]
except
IndexError
:
previous
=
None
self
.
stderr
.
write
(
self
.
style
.
WARNING
(
"
[warning] Ignoring undecodable path. Previous ok file was {}
"
.
format
(
previous
)
)
)
if
options
[
"
in_place
"
]:
self
.
stdout
.
write
(
"
Checking imported paths against settings.MUSIC_DIRECTORY_PATH
"
...
...
This diff is collapsed.
Click to expand it.
changes/changelog.d/138.bugfix
0 → 100644
+
1
−
0
View file @
79f9dae5
Raise a warning instead of crashing when getting a broken path in file import (#138)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment