ryanvilbrandt / comic_git

A statically-hosted web comic server core intended to be hosted on github.io. For help getting started, click the Wiki link above!
23 stars 7 forks source link

utils.py always sets base_directory to <repo_name> when building in the Github Environment using recommended settings for a custom domain #73

Closed T-Applesmith closed 1 year ago

T-Applesmith commented 1 year ago

This issue causes the html to build with the base url of "www.\<customdomain>.com/" instead of "www.\<customdomain>.com", which causes a multitude of features to break, including links and images. System builds and runs as expected when deploying locally using recommended local settings.

When inspecting the homepage html source, inspecting the following property is a clear indicator if this issue is present, a system that functions as expected should be of the format: meta property="og:url" content="https://www.\<customdomain>.com" whereas a system with the issue present will be of the format: meta property="og:url" content="https://www.\<customdomain>.com/"

When following the custom domain setup instructions on the wiki, the user is instructed to leave option "Comic subdirectory' present and blank. In get_comic_url in utils.py, the default value of base_directory (the comic subdirectory) is an empty string. The ini file is then evaluated, and as "Comic subdirectory" is blank, base_directory is re-set to an empty string. Later this is evaluated to see if the system is being built by a github process, and if true it checks if comic_domain or base_directory are false. In python an empty string evaluates to false, thus taking the base_directory conditional and it gets set to the instead of remaining empty. The comic_domain and base_directory are later concatenated. This always results in the url being of the format "www.\<customdomain>.com/" when using recommended settings for a custom domain when building through Github.

My current resolution for this issue is to change line 26 in utils.py from checking against if base_directory is false to instead checking if the "Comic subdirectory" option does not exist. I have not fully explored the ramifications of this change however the system appears to function similarly to the local build.

ryanvilbrandt commented 1 year ago

This bug is fixed in the upcoming 1.0 release. This is good motivation to get that release out sooner rather than later.