From 43c82a6371dc666a363c639c49a94c444f117634 Mon Sep 17 00:00:00 2001 From: Koichi Shiraishi Date: Tue, 11 Jun 2019 19:45:48 +0900 Subject: [PATCH] uri: change URI.Filename to just returns the filename --- uri.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/uri.go b/uri.go index 0e512e0..00867c1 100644 --- a/uri.go +++ b/uri.go @@ -45,15 +45,15 @@ const ( // urn:example:animal:ferret:nose type URI string -// Filename returns the file path for the given URI. It will return an error if -// the URI is invalid, or if the URI does not have the file scheme. -func (u URI) Filename() (string, error) { +// Filename returns the file path for the given URI. +// It is an error to call this on a URI that is not a valid filename. +func (u URI) Filename() string { filename, err := filename(u) if err != nil { - return "", err + panic(err) } - return filepath.FromSlash(filename), nil + return filepath.FromSlash(filename) } func filename(uri URI) (string, error) {