#2026·PrivateBin

`defaultformatter` config option is ignored when starting a new paste

Author: achappardCreated Sep 16, 2026Updated Sep 17, 2026
Labelsbugdiscuss meUI/UX

Describe the problem/question

The defaultformatter option in cfg/conf.php is correctly rendered server-side (the matching <option> gets selected="selected" in the initial HTML), but it gets overridden by client-side JavaScript as soon as the page finishes loading (or when clicking "New").

Steps to reproduce

  1. Set defaultformatter = "markdown" in cfg/conf.php (with markdown present in [formatter_options]).
  2. Restart php-fpm / clear any opcache to make sure the new config is loaded.
  3. Load the instance's homepage (a fresh "new paste" view).
  4. Inspect the format dropdown.

What happens

  • The raw HTML (verified via curl) correctly shows <option value="markdown" selected="selected">.
  • However, after the page's JS runs, document.getElementById('pasteFormatter').value returns "plaintext", and the visible dropdown shows "Plain Text" instead of "Markdown".

What should happen

The dropdown should stay on the configured defaultformatter value ("markdown" in this case) after the page finishes loading.

Root cause (found while debugging)

In js/privatebin.js, Controller.newPaste() contains:

```js // reset format PasteViewer.setFormat('plaintext'); TopNav.setFormat('plaintext'); ```

This hardcodes 'plaintext' instead of reading the configured default via Model.getFormatDefault() (which is used correctly elsewhere, e.g. around line 2918: format = Model.getFormatDefault() || format;).

Since Controller.newPaste() runs both on initial page load and when clicking "New", any defaultformatter other than "plaintext" is effectively unusable.

Additional information

  • Tested on a self-hosted