Skip to content

Commit

Permalink
fixed recursion error not being raised properly
Browse files Browse the repository at this point in the history
  • Loading branch information
xnetcat committed Dec 27, 2022
1 parent 8b2a7c9 commit 15df07f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions spotdl/utils/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,12 @@ def create_file_name(
# and we are already using the short version of the template,
# fallback to default template
if short is True:
# This will probably never occur, but just in case
if template == "/{artist} - {title}.{output-ext}":
raise RecursionError(
f'"{song.display_name} is too long to be shortened. File a bug report on GitHub'
)

warnings.warn(
f"{song.display_name}: File name is too long. Using the default template."
)
Expand All @@ -328,12 +334,6 @@ def create_file_name(
short=short,
)

# This will probably never occur, but just in case
if short is True and template == "/{artist} - {title}.{output-ext}":
raise RecursionError(
f'"{song.display_name} is too long to be shortened. File a bug report on GitHub'
)

return create_file_name(
song,
template,
Expand Down

0 comments on commit 15df07f

Please sign in to comment.