Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] (BibleGateway) Hyperlink broken when bookName contains space #185

Closed
abbasou opened this issue May 9, 2024 · 2 comments
Closed

[Bug] (BibleGateway) Hyperlink broken when bookName contains space #185

abbasou opened this issue May 9, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@abbasou
Copy link
Contributor

abbasou commented May 9, 2024

Describe the bug
When using a version from BibleGateway and the Book Name contains a space (i.e. "1 Timothy," "2 Chronicles," etc.) the link to BibleGateway will be broken. This will cause formatting issues as well.

To Reproduce
Steps to reproduce the behavior:

  1. Insert a reference from a BibleGateway version where the Book contains a space in the name.
  2. See error

Expected behavior
The linker should replace the space with a "+" for a proper hyperlink and correct formatting.

Screenshots
image
image

What Device Do You Use(please complete the following information):

  • Device: Desktop Computer
  • OS: Windows 11
  • Version 2.4.4
@abbasou abbasou added the bug Something isn't working label May 9, 2024
@abbasou
Copy link
Contributor Author

abbasou commented May 9, 2024

So in poking around a bit, I came across the following snippet:

var BibleAPIDotComProvider = class extends BaseBibleAPIProvider {
  constructor(bibleVersion) {
    super(bibleVersion);
  }
  /**
   * Build Request Url for Bible-Api.com
   * @param bookName
   * @param chapter
   * @param verses
   * @param versionName
   */
  buildRequestURL(bookName, chapter, verses, versionName) {
    let queryString = `${bookName}+${chapter}:`.replace(/ /g, "+");
    queryString += this.convertVersesToQueryString(verses);
    this._currentQueryUrl = `${this._apiUrl}/${queryString}?translation=${versionName ? versionName : (this == null ? void 0 : this.BibleVersionKey) ? this.BibleVersionKey : ""}`;
    this.bibleGatewayUrl = this.buildBibleGatewayUrl(bookName, chapter, verses);
    return this._currentQueryUrl;
  }

and noticed the .replace function. I moved it down toward the end of the function as so:
this.bibleGatewayUrl = this.buildBibleGatewayUrl(bookName, chapter, verses).replace(/ /g, "+");
and restarted Obsidian and lo and behold it worked!

@abbasou abbasou changed the title [Bug] (BibleGateway) Hyperlink broken when bookName contains [space] [Bug] (BibleGateway) Hyperlink broken when bookName contains space May 9, 2024
@tim-hub tim-hub self-assigned this May 10, 2024
abbasou added a commit to abbasou/obsidian-bible-reference that referenced this issue May 12, 2024
@tim-hub
Copy link
Owner

tim-hub commented May 15, 2024

@tim-hub tim-hub closed this as completed May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

2 participants