fix getFileExtension missing numeric extensions (e.g. mp4)
This commit is contained in:
		
							parent
							
								
									e21f0f9bb9
								
							
						
					
					
						commit
						e4950e06a1
					
				
					 3 changed files with 3 additions and 4 deletions
				
			
		| 
						 | 
					@ -13,9 +13,7 @@ export default (() => {
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      segments.push(timeTaken)
 | 
					      segments.push(timeTaken)
 | 
				
			||||||
      return (
 | 
					      return <p class="content-meta">{segments.join(", ")}</p>
 | 
				
			||||||
        <p class="content-meta">{segments.join(", ")}</p>
 | 
					 | 
				
			||||||
      )
 | 
					 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      return null
 | 
					      return null
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -145,6 +145,7 @@ describe("transforms", () => {
 | 
				
			||||||
        ["/content/index.md", "content/index"],
 | 
					        ["/content/index.md", "content/index"],
 | 
				
			||||||
        ["content/cool.png", "content/cool"],
 | 
					        ["content/cool.png", "content/cool"],
 | 
				
			||||||
        ["index.md", "index"],
 | 
					        ["index.md", "index"],
 | 
				
			||||||
 | 
					        ["test.mp4", "test"],
 | 
				
			||||||
        ["note with spaces.md", "note-with-spaces"],
 | 
					        ["note with spaces.md", "note-with-spaces"],
 | 
				
			||||||
      ],
 | 
					      ],
 | 
				
			||||||
      path.slugifyFilePath,
 | 
					      path.slugifyFilePath,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -221,7 +221,7 @@ function _hasFileExtension(s: string): boolean {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function _getFileExtension(s: string): string | undefined {
 | 
					function _getFileExtension(s: string): string | undefined {
 | 
				
			||||||
  return s.match(/\.[A-Za-z]+$/)?.[0]
 | 
					  return s.match(/\.[A-Za-z0-9]+$/)?.[0]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function _isRelativeSegment(s: string): boolean {
 | 
					function _isRelativeSegment(s: string): boolean {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue