Skip to content

Commit

Permalink
テンプレートマッピングにbasenameを含まないとき正しく動作しなかったのを修正
Browse files Browse the repository at this point in the history
  • Loading branch information
takeyuweb committed May 28, 2019
1 parent 4f05ee2 commit 222ed0d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/PreviewURL/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ l10n_class: PreviewURL::L10N
id: PreviewURL
key: previewurl
name: <__trans phrase="PreviewURL">
version: 1.5
version: 1.6
author_name: <__trans phrase="_PLUGIN_AUTHOR">
author_link: http://takeyu-web.com/
description: <__trans phrase="_PLUGIN_DESCRIPTION">
Expand Down
13 changes: 13 additions & 0 deletions plugins/PreviewURL/lib/PreviewURL/CMS.pm
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@ sub _view_preview {
$obj->basename( $preview_basename );

my $archive_file = $obj->archive_file();

require File::Basename;
my $file_ext;
my ($orig_file, $path) = File::Basename::fileparse($archive_file);
my $archive_file_ext = (File::Basename::fileparse($orig_file, qr/\.[^\.]+$/))[2];
if ($archive_file_ext) {
$file_ext = $archive_file_ext;
} else {
if ( $blog->file_extension ) {
$file_ext = '.' . $blog->file_extension;
}
}
$archive_file = File::Spec->catfile($path, $preview_basename . $file_ext);

my $blog_url
= $type eq 'page'
Expand Down

0 comments on commit 222ed0d

Please sign in to comment.