Narweb: in cms mode, some inconsistent image links (#1157)

This commit is contained in:
Serge Noiraud 2020-12-29 10:01:25 +01:00 committed by GitHub
parent 06e5ff4e66
commit 3d4ec8382d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 8 deletions

View File

@ -2054,7 +2054,7 @@ class BasePage:
image=True) image=True)
imag.attr += ' src = "%s" alt = "%s"' % (newpath, descr) imag.attr += ' src = "%s" alt = "%s"' % (newpath, descr)
fname = self.report.build_url_fname(obj.get_handle(), fname = self.report.build_url_fname(obj.get_handle(),
"img", False, "img", uplink=2,
image=True, image=True,
) + self.ext ) + self.ext
inc_gallery = self.report.options['gallery'] inc_gallery = self.report.options['gallery']
@ -2771,7 +2771,8 @@ class BasePage:
of the result. of the result.
@param: usedescr -- Add media description @param: usedescr -- Add media description
""" """
url = self.report.build_url_fname_html(media_handle, "img", uplink) url = self.report.build_url_fname(media_handle, "img", uplink,
image=True) + self.ext
name = html_escape(name) name = html_escape(name)
# begin thumbnail division # begin thumbnail division

View File

@ -335,7 +335,8 @@ class MediaPages(BasePage):
result. result.
""" """
# get media url # get media url
url = self.report.build_url_fname_html(handle, "img", uplink) url = self.report.build_url_fname(handle, "img", uplink=2,
image=True) + self.ext
# get name # get name
name = html_escape(name) name = html_escape(name)
@ -642,7 +643,8 @@ class MediaPages(BasePage):
@param: uplink -- If True, then "../../../" is inserted in front of the @param: uplink -- If True, then "../../../" is inserted in front of the
result. result.
""" """
url = self.report.build_url_fname_html(handle, "img", uplink) url = self.report.build_url_fname(handle, "img", uplink,
image=True) + self.ext
name = html_escape(name) name = html_escape(name)
return Html("a", name, name=name, id=name, href=url, return Html("a", name, name=name, id=name, href=url,
title=name, inline=True) title=name, inline=True)

View File

@ -1408,10 +1408,16 @@ class NavWebReport(Report):
else: else:
subdirs = [self.target_uri] + subdirs subdirs = [self.target_uri] + subdirs
elif self.target_uri not in fname: elif self.target_uri not in fname:
if self.the_lang and subdir not in ["css", "images", "thumb"]:
subdirs = [self.target_uri] + [self.the_lang] + [fname]
else:
subdirs = [self.target_uri] + [fname] subdirs = [self.target_uri] + [fname]
else: else:
subdirs = [] subdirs = []
else: else:
if self.the_lang and image and uplink != 2:
if subdir and subdir[0:3] not in ["css", "ima", "thu"]:
subdirs = [self.the_lang] + subdirs
if uplink is True: if uplink is True:
nb_dir += 3 nb_dir += 3
subdirs = ['..']*nb_dir + subdirs subdirs = ['..']*nb_dir + subdirs
@ -1597,12 +1603,12 @@ class NavWebReport(Report):
False, image) False, image)
if self.target_uri in subdirs and image: if self.target_uri in subdirs and image:
subdirs.remove(self.target_uri) subdirs.remove(self.target_uri)
if subdir[0:3] in ["css", "ima", "thu"]: if subdir[0:3] in ["css", "img", "ima", "thu"]:
subdirs = [self.target_uri] + subdirs subdirs = [self.target_uri] + subdirs
else: else:
if fname[0:3] in ["css", "ima", "thu"]: if fname[0:3] in ["css", "img", "ima", "thu"]:
subdirs = [self.target_uri] subdirs = [self.target_uri]
elif fname[3:6] in ["css", "ima", "thu"]: elif fname[3:6] in ["css", "img", "ima", "thu"]:
subdirs = [self.target_uri] subdirs = [self.target_uri]
fname = fname[3:] fname = fname[3:]
else: else: