C0D3D3V / Moodle-DL

Moodle-DL downloads course content fast from Moodle (eg. lecture pdfs)
GNU General Public License v3.0
433 stars 63 forks source link

Don't try to download the mailto links #193

Closed daniarla closed 7 months ago

daniarla commented 1 year ago

Description of the bug

If there is a mailto link in the description of an assignment and moodle-dl is configured to download the description of assignment it tries to download the mailto link (mailto:valid@email.org) and fails. Not a big deal its only an error in the logs.

Technical details

C0D3D3V commented 1 year ago

Mh, the idea was that moodle-dl creates URL files for these mailto links. So that you always have a fast access to the professors mail adresse in your files. It also should not create errors for it in the logs, because it should detect that it is not downloadable in firstplace (at least thats how I remember it). I will have a look at it after vacations.

daniarla commented 1 year ago

This are the logs, this is super low priority so enjoy your vacations!

2023-06-07 11:10:39  DEBUG  {task}  [0] Starting downloading of: [Course]/[Section]/[assignment]/mailto:email.mail@email.com
2023-06-07 11:10:39  DEBUG  {task}  [0] Creating a shortcut
2023-06-07 11:10:39  ERROR  {task}  [0] AttributeError("'NoneType' object has no attribute 'endswith'")
2023-06-07 11:10:39  ERROR  {task}  [0] Error while trying to download file: 'NoneType' object has no attribute 'endswith'
2023-06-07 11:10:39  DEBUG  {task}  [0] file size: 229; downloaded: 0
2023-06-07 11:10:39  DEBUG  {task}  [0] Traceback:
Traceback (most recent call last):
  File "/home/user/.local/lib/python3.11/site-packages/moodle_dl/downloader/task.py", line 727, in real_run
    if self.opts.download_linked_files and not self.is_filtered_external_domain():
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/.local/lib/python3.11/site-packages/moodle_dl/downloader/task.py", line 565, in is_filtered_external_domain
    if domain == entry or domain.endswith('.' + entry):
                          ^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'endswith'

And then:

mailto:email.mail@email.com
    'NoneType' object has no attribute 'endswith'

Could it be because there are . before the @ and it confuses the downloader?