diff --git a/src/Form/FillPdfSettingsForm.php b/src/Form/FillPdfSettingsForm.php
index 6b8757f4e06912ce61b08270107d1e623ebcff6f..79acbe332bfe80858fc611dc4871651801d93949 100644
--- a/src/Form/FillPdfSettingsForm.php
+++ b/src/Form/FillPdfSettingsForm.php
@@ -277,7 +277,7 @@ class FillPdfSettingsForm extends ConfigFormBase {
 
     $directory = FillPdf::buildFileUri($form_state->getValue('scheme'), 'fillpdf');
     if (!file_prepare_directory($directory, FILE_CREATE_DIRECTORY + FILE_MODIFY_PERMISSIONS)) {
-      $form_state->setErrorByName('upload_pdf', $this->t('Could not automatically create the <em>fillpdf</em> subdirectory. Please create this manually before uploading your PDF form.'));
+      $form_state->setErrorByName('scheme', $this->t('Could not automatically create the <em>fillpdf</em> subdirectory. Please create this manually before uploading your PDF form.'));
     }
   }
 
diff --git a/tests/src/Functional/FillPdfSettingsFormTest.php b/tests/src/Functional/FillPdfSettingsFormTest.php
index 2e238146b4e3d9b8e391ea5690c28528bd933547..30c9500974a5ecbdef7e4fabbe7d3035e147712e 100644
--- a/tests/src/Functional/FillPdfSettingsFormTest.php
+++ b/tests/src/Functional/FillPdfSettingsFormTest.php
@@ -120,6 +120,42 @@ class FillPdfSettingsFormTest extends BrowserTestBase {
     $this->assertEqual($this->config('fillpdf.settings')->get('scheme'), 'private');
   }
 
+  /**
+   * Tests the scheme settings with the 'public' stream wrapper.
+   */
+  public function testSettingsFormSchemePublic() {
+    // FillPDF is not yet configured.
+    // Configure FillPDF with the 'test' backend and the site default scheme,
+    // which at this point is 'public'.
+    $this->configureBackend();
+
+    // On the settings page, verify the 'public' scheme is set both in the form
+    // and in config.
+    $this->drupalGet(Url::fromRoute('fillpdf.settings'));
+    $this->assertSession()->fieldValueEquals('scheme', 'public');
+    $this->assertEqual($this->config('fillpdf.settings')->get('scheme'), 'public');
+
+    // Verify the subdirectory doesn't exist yet.
+    $directory = 'public://fillpdf';
+    $this->assertFalse(is_dir($directory), 'Directory does not exist prior to testing.');
+
+    // Now on the settings form, save the unchanged configuration to create the
+    // subdirectory. Verify it does exist now and is writeable.
+    $this->drupalPostForm(NULL, [], 'Save configuration');
+    $this->assertSession()->pageTextContains('The configuration options have been saved.');
+    $this->assertTrue(is_dir($directory), 'Directory exists now.');
+    $this->assertTrue(file_prepare_directory($directory), 'Directory is writeable.');
+
+    // Now delete the directory and replace it with a file with the same name,
+    // so the directory can't be recreated. Try saving again and verify an error
+    // is set.
+    drupal_rmdir($directory);
+    file_unmanaged_copy('public://.htaccess', $directory);
+    $this->drupalPostForm(NULL, [], 'Save configuration');
+    $this->assertSession()->pageTextNotContains('The configuration options have been saved.');
+    $this->assertSession()->pageTextContains('Could not automatically create the fillpdf subdirectory.');
+  }
+
   /**
    * Tests the backend settings with the 'fillpdf_service' backend.
    */