Repository: dotenv-linter/dotenv-linter (rust)
Issue: Falls on checking multi-line values
Example:

```env
MULTILINE="
{
    'key': 'value'
}
"
```

Result:

```
Checking .env
thread 'main' panicked at 'begin <= end (1 <= 0) when slicing `"`', src/common/line_entry.rs:94:26
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
Pull request description: fix(#461): fail with one quote-char in line
<!--
Thank you for your pull request. Please provide a description above and review
the requirements below.

Bug fixes and new features should include tests.
-->
It pretty simple bug. I've added test.
Closes #461 

<!-- _Please make sure to review and check all of these items:_ -->

#### ✔ Checklist:
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

- [x] Commit messages have been written in [Conventional Commits](https://www.conventionalcommits.org) format;
- [x] This PR has been added to [CHANGELOG.md](https://github.com/dotenv-linter/dotenv-linter/blob/master/CHANGELOG.md) (at the top of the list);
- [x] Tests for the changes have been added (for bug fixes / features);
- [ ] Docs have been added / updated on the [dotenv-linter.github.io](https://github.com/dotenv-linter/dotenv-linter.github.io) (for bug fixes / features).

<!-- _NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open._ -->


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 21d7df9..1908adb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,6 +21,7 @@ ### 🔧 Changed
 - Add type alias for `Result` [#445](https://github.com/dotenv-linter/dotenv-linter/pull/445) ([@mgrachev](https://github.com/mgrachev))
 - Change edition to 2021 [#444](https://github.com/dotenv-linter/dotenv-linter/pull/444) ([@mgrachev](https://github.com/mgrachev))
 - Display a message on installation error [#443](https://github.com/dotenv-linter/dotenv-linter/pull/443) ([@mgrachev](https://github.com/mgrachev))
+- Fix falling on checking multi-line values [#462](https://github.com/dotenv-linter/dotenv-linter/pull/462) ([@DDtKey](https://github.com/DDtKey))
 
 ## [v3.1.1] - 2021-08-25
 ### 🚀 Added
diff --git a/src/common/line_entry.rs b/src/common/line_entry.rs
index 3aa7c31..b6a07b9 100644
--- a/src/common/line_entry.rs
+++ b/src/common/line_entry.rs
@@ -90,7 +90,7 @@ pub fn get_substitution_keys(&self) -> Vec<&str> {
         };
 
         if value.starts_with('\"') {
-            if value.ends_with('\"') && !is_escaped(&value[..value.len() - 1]) {
+            if value.len() > 1 && value.ends_with('\"') && !is_escaped(&value[..value.len() - 1]) {
                 value = &value[1..value.len() - 1]
             } else {
                 return keys;
diff --git a/src/common/quote_type.rs b/src/common/quote_type.rs
index 7e52efa..00078d9 100644
--- a/src/common/quote_type.rs
+++ b/src/common/quote_type.rs
@@ -15,7 +15,7 @@ pub fn char(&self) -> char {
 
     pub fn is_quoted_value(&self, val: &str) -> bool {
         val.starts_with(self.char())
-            && (!val.ends_with(self.char()) || is_escaped(&val[..val.len() - 1]))
+            && (val.len() == 1 || !val.ends_with(self.char()) || is_escaped(&val[..val.len() - 1]))
     }
 }
 


Test patch:
diff --git a/tests/output/check.rs b/tests/output/check.rs
index 320307e..0ab266d 100644
--- a/tests/output/check.rs
+++ b/tests/output/check.rs
@@ -45,8 +45,10 @@ fn valid_multiline_value_test() {
         ".env",
         "FOO=bar\nMULTILINE_1='{\n\"first\": 1,\n\"second\": 1\n}'\nMULTILINE_2='multiline \\'escaped\\' \n value'\nZAC=baz\n",
     );
+    test_dir.create_testfile(".env1", "MULTILINE=\"\n{\n'key':'value'\n}\n\"\n");
 
     let expected_output = r#"Checking .env
+Checking .env1
 
 No problems found
 "#;