fnp
/
wolnelektury.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
333f7cc
)
Fix downloading images on publish.
author
Radek Czajka
<rczajka@rczajka.pl>
Mon, 2 May 2022 13:33:22 +0000
(15:33 +0200)
committer
Radek Czajka
<rczajka@rczajka.pl>
Mon, 2 May 2022 13:33:22 +0000
(15:33 +0200)
src/catalogue/models/book.py
patch
|
blob
|
history
diff --git
a/src/catalogue/models/book.py
b/src/catalogue/models/book.py
index
ea4debd
..
6b9fd72
100644
(file)
--- a/
src/catalogue/models/book.py
+++ b/
src/catalogue/models/book.py
@@
-561,6
+561,7
@@
class Book(models.Model):
# will make problems in conjunction with paid previews
def download_pictures(self, remote_gallery_url):
# will make problems in conjunction with paid previews
def download_pictures(self, remote_gallery_url):
+ # This is only needed for legacy relative image paths.
gallery_path = self.gallery_path()
# delete previous files, so we don't include old files in ebooks
if os.path.isdir(gallery_path):
gallery_path = self.gallery_path()
# delete previous files, so we don't include old files in ebooks
if os.path.isdir(gallery_path):
@@
-572,6
+573,8
@@
class Book(models.Model):
makedirs(gallery_path)
for ilustr in ilustr_elements:
ilustr_src = ilustr.get('src')
makedirs(gallery_path)
for ilustr in ilustr_elements:
ilustr_src = ilustr.get('src')
+ if '/' in ilustr_src:
+ continue
ilustr_path = os.path.join(gallery_path, ilustr_src)
urlretrieve('%s/%s' % (remote_gallery_url, ilustr_src), ilustr_path)
ilustr_path = os.path.join(gallery_path, ilustr_src)
urlretrieve('%s/%s' % (remote_gallery_url, ilustr_src), ilustr_path)