properly handle absolute paths

This commit is contained in:
rra 2020-01-27 10:16:55 +01:00
parent 57b7d4d793
commit d868d65c74

View File

@ -97,18 +97,15 @@ def generate_metadata(path, context):
if 'i18n_subsites' in plugins: if 'i18n_subsites' in plugins:
subsites = True subsites = True
lang = context['DEFAULT_LANG'] lang = context['DEFAULT_LANG']
general_output_path = output_path.replace(lang, '').strip('/') general_output_path = output_path.replace(lang, '')
siteurl = siteurl.replace(lang,'').strip('/') siteurl = context['main_siteurl']
media_size = 0 media_size = 0
# enumerate all media displayed on the page # enumerate all media displayed on the page
media, soup = get_media(path) #reuse the same soup to limit calculation media, soup = get_media(path) #reuse the same soup to limit calculation
for m in media: for m in media:
# filter out SITEURL to prevent trouble # filter out SITEURL to prevent trouble
#print(context['SITEURL'], m)
# join output path to file, need to strip any leading slash for os.path # join output path to file, need to strip any leading slash for os.path
if subsites: if subsites:
file_name = m.replace(context['main_siteurl']+'/', '') file_name = m.replace(context['main_siteurl']+'/', '')