Skip to content

Commit 803606b

Browse files
committed
properly attach '.woff2' to filenames without suffix
1 parent 550cfa6 commit 803606b

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/woff2_compress.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,14 @@ int main(int argc, char **argv) {
2121
}
2222

2323
string filename(argv[1]);
24-
string outfilename = filename.substr(0, filename.find_last_of(".")) + ".woff2";
24+
int lastdot;
25+
string outfilename;
26+
if ((lastdot = filename.find_last_of(".")) > filename.find_last_of("/")) {
27+
outfilename = filename.substr(0, lastdot) + ".woff2";
28+
} else {
29+
outfilename = filename + ".woff2";
30+
}
31+
2532
fprintf(stdout, "Processing %s => %s\n",
2633
filename.c_str(), outfilename.c_str());
2734
string input = woff2::GetFileContent(filename);

0 commit comments

Comments
 (0)