Skip to content

Commit

Permalink
fix faulty string manipulation in 07-download-button.js
Browse files Browse the repository at this point in the history
  • Loading branch information
monsieuremre authored Jun 9, 2024
1 parent 77c7dd1 commit e286bfe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/js/07-download-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const lastIndex = url.lastIndexOf('/')
const newUrl = url.substring(0, lastIndex)

var titleContent = document.querySelector('h3.title').textContent
const fileName = titleContent.toLowerCase().replace(/:/g, '').replace(/\s/g, '-') + '.pdf'
const fileName = titleContent.toLowerCase().replace(/[():-[]{}]/g, '').replace(/\s+/g, ' ').replace(/\s/g, '-') + '.pdf'

downloadButton.addEventListener('click', function () {
window.location.href = newUrl + '/' + fileName
Expand Down

0 comments on commit e286bfe

Please sign in to comment.