def create_link(runResult, base_dir, column): source_file = runResult.task_id[0] href = column.href or runResult.log_file if href.startswith("http://") or href.startswith("https://") or href.startswith("file:"): # quote special characters only in inserted variable values, not full URL source_file = url_quote(source_file) href = model.substitute_vars([href], None, source_file)[0] return href # quote special characters everywhere (but not twice in source_file!) href = model.substitute_vars([href], None, source_file)[0] return url_quote(os.path.relpath(href, base_dir))
def create_link(runResult, base_dir, column): if not column.href: return os.path.relpath(runResult.log_file, base_dir) source_file = runResult.task_id[0] href = model.substitute_vars([column.href], None, source_file)[0] if href.startswith("http://") or href.startswith("https://"): return href return os.path.relpath(href, base_dir)