aaronpk / Quill

🖋 A Micropub client for creating posts
https://quill.p3k.io/
117 stars 25 forks source link

Malformed HTML when fetching Channels #140

Open jalcine opened 2 years ago

jalcine commented 2 years ago

My Micropub endpoint returns channel information using the object notation. It looks like Quill expects it to be a list of strings/uids instead. My uids aren't too human friendly however. Is it possible for it to check for this and present it accordingly?

HTML of /settings:

<div class="form-group">
          <label for="note_channels"><a href="javascript:reload_channels()">Reload</a></label>
          <div id="channel-container">
            <select class="form-control" name="channel"><html><head><title>Slim Application Error</title><style>body{margin:0;padding:30px;font:12px/1.5 Helvetica,Arial,Verdana,sans-serif;}h1{margin:0;font-size:48px;font-weight:normal;line-height:48px;}strong{display:inline-block;width:65px;}</style></head><body><h1>Slim Application Error</h1><p>The application could not run because of the following error:</p><h2>Details</h2><div><strong>Type:</strong> ErrorException</div><div><strong>Code:</strong> 2</div><div><strong>Message:</strong> htmlspecialchars() expects parameter 1 to be string, array given</div><div><strong>File:</strong> /web/sites/quill.p3k.io/views/settings.php</div><div><strong>Line:</strong> 100</div><h2>Trace</h2><pre>#0 [internal function]: Slim\Slim::handleErrors()
#1 /web/sites/quill.p3k.io/views/settings.php(100): htmlspecialchars()
#2 /web/sites/quill.p3k.io/vendor/saltybeagle/savant3/Savant3.php(1074): include('/web/sites/quil...')
#3 /web/sites/quill.p3k.io/views/layout.php(71): Savant3->fetch()
#4 /web/sites/quill.p3k.io/vendor/saltybeagle/savant3/Savant3.php(1074): include('/web/sites/quil...')
#5 /web/sites/quill.p3k.io/lib/Savant.php(74): Savant3->fetch()
#6 /web/sites/quill.p3k.io/vendor/slim/slim/Slim/View.php(195): Slim\Extras\Views\Savant->render()
vikanezrimaya commented 2 years ago

This completely breaks the channel functionality for me. While Kittybox can substitute a "default" channel in scenarios where no channel is specified (This uses some heuristics based on post content, which I don't like, but am forced to deal with), having this broken is an issue.

vikanezrimaya commented 2 years ago

views/settings.php:99-101 replace with check for stringness and if not, use uid as value and name as user-visible name

just taking notes, maybe i'll make a PR if I manage to remember PHP