Fix detecting of external links
Checking whether we have a file (on the FS) here is not enough for either case (external link/internal link). Thus, we should check whether a store entry with that ID exists. If it does, we link internally, else externally by trying to parse the string as URL. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
parent
a101e777f3
commit
029b83042d
1 changed files with 1 additions and 1 deletions
|
@ -147,7 +147,7 @@ fn link_from_to<'a, I>(rt: &'a Runtime, from: &'a str, to: I)
|
||||||
|
|
||||||
for entry in to {
|
for entry in to {
|
||||||
debug!("Handling 'to' entry: {:?}", entry);
|
debug!("Handling 'to' entry: {:?}", entry);
|
||||||
if PathBuf::from(entry).exists() {
|
if !rt.store().get(PathBuf::from(entry)).map_err_trace_exit_unwrap(1).is_some() {
|
||||||
debug!("Linking externally: {:?} -> {:?}", from, entry);
|
debug!("Linking externally: {:?} -> {:?}", from, entry);
|
||||||
let url = Url::parse(entry).unwrap_or_else(|e| {
|
let url = Url::parse(entry).unwrap_or_else(|e| {
|
||||||
error!("Error parsing URL: {:?}", e);
|
error!("Error parsing URL: {:?}", e);
|
||||||
|
|
Loading…
Reference in a new issue