Skip to content

Commit 835fdf0

Browse files
authored
Merge pull request #810 from hydephp/update-file-extension-getter-to-trim-trailing-periods-from-extension-less-page-types
Update HydePage::fileExtension() getter to trim trailing periods to support extension-less page types
2 parents 1ed5791 + 08411c4 commit 835fdf0

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

packages/framework/src/Pages/Concerns/HydePage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ final public static function outputDirectory(): string
144144
*/
145145
final public static function fileExtension(): string
146146
{
147-
return '.'.ltrim(static::$fileExtension, '.');
147+
return rtrim('.'.ltrim(static::$fileExtension, '.'), '.');
148148
}
149149

150150
/**

packages/framework/tests/Feature/HydePageTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,13 @@ public function test_get_file_extension_forces_leading_period()
203203
$this->resetDirectoryConfiguration();
204204
}
205205

206+
public function test_get_file_extension_removes_trailing_period()
207+
{
208+
MarkdownPage::$fileExtension = 'foo.';
209+
$this->assertEquals('.foo', MarkdownPage::fileExtension());
210+
$this->resetDirectoryConfiguration();
211+
}
212+
206213
public function test_get_identifier_returns_identifier_property()
207214
{
208215
$page = new MarkdownPage('foo');

0 commit comments

Comments
 (0)