File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed
src/ProgrammerAl.Site/ProgrammerAl.Site/Pages Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change 1
- @page " /posts/{PostUrl}/slides/{Index}"
2
- @page " /drafts/{PostUrl}/slides/{Index}"
1
+ @page " /posts/{PostUrl}/slides/{Index:int }"
2
+ @page " /drafts/{PostUrl}/slides/{Index:int }"
3
3
@using System .Text .Encodings .Web ;
4
4
@using ProgrammerAl .Site .Components
5
5
Original file line number Diff line number Diff line change @@ -21,23 +21,21 @@ public partial class PresentationSlides : ComponentBase
21
21
public string ? PostUrl { get ; set ; }
22
22
23
23
[ Parameter ]
24
- public int ? Index { get ; set ; }
24
+ public int Index { get ; set ; }
25
25
26
26
private MarkupString SlidesHtml { get ; set ; }
27
27
private PostData ? PostData { get ; set ; }
28
28
29
29
protected override async Task OnInitializedAsync ( )
30
30
{
31
- if ( ! string . IsNullOrWhiteSpace ( PostUrl ) )
31
+ if ( ! string . IsNullOrWhiteSpace ( PostUrl ) && Index > - 1 )
32
32
{
33
33
PostData = await PostDataProvider . GetPostAsync ( PostUrl ) ;
34
34
35
35
if ( PostData is object
36
- && Index . HasValue
37
- && Index > - 1
38
- && Index < PostData . Metadata . PresentationSlideUrls . Length )
36
+ && Index < PostData . Metadata . PresentationSlideUrls . Length )
39
37
{
40
- var slidesUrl = PostData . Metadata . PresentationSlideUrls [ Index . Value ] ;
38
+ var slidesUrl = PostData . Metadata . PresentationSlideUrls [ Index ] ;
41
39
var slidesHtml = await FileDownloader . DownloadFileTextFromSiteContentAsync ( slidesUrl , "*/*" ) ;
42
40
if ( ! string . IsNullOrWhiteSpace ( slidesHtml ) )
43
41
{
You can’t perform that action at this time.
0 commit comments