toto04 / webeep-sync

Keep all your WeBeep files synced on your computer!
GNU General Public License v3.0
55 stars 6 forks source link

Fix compatibility issue with Moodle book component #84

Closed PiervitoCreanza closed 1 year ago

PiervitoCreanza commented 1 year ago

For some strange reason, HTML files inside a book component have their webeep file size property set to 0:

{"type":"file","filename":"index.html","filepath":"/467/","filesize":0,"fileurl":"https://webeep.polimi.it/webservice/pluginfile.php/426763/mod_book/chapter/467/index.html","content":"Argomenti del corso.","timecreated":0,"timemodified":1662216028,"sortorder":0,"userid":null,"author":null,"license":null,"tags":[]}

Because of this, since 0 is obviously different from the actual file size, the file gets downloaded on every sync event.

I don't know if this is the standard behaviour of HTML files located in a book module, but I think that the size property should be checked in order to verify that it isn't zero. This would prevent new downloads on every sync.

toto04 commented 1 year ago

Hi sorry for getting back to you just now. Thank you for making this! Looks great, quite an easy fix. But just before I merge, what do you think, should book resources even be synced in the first place? Or should they be in the excluded modnames? Can you give me the name of the course that contains this file so I can try enrolling in it and recreating this myself? out of curiosity lol, I'd like to see the whole response from the core_course_get_contents call

PiervitoCreanza commented 1 year ago

No worries! I think that it would be better to sync them, as there may be useful files inside. Here is the course ID: 787840.