Sorry Josh, but which solution looks good to you? :) If you press SaveAs on
an existing file called LICENSE, should a new suggested filename be LICENSE
or LICENSE.txt?


On Fri, Jan 31, 2014 at 3:25 PM, joshwoodward <notifications@github.com>wrote:

> In js/util.js:
>
> > @@ -60,3 +60,18 @@ util.writeToWriter_ = function(writer, blob, onsuccess) {
> >  util.sanitizeFileName = function(fileName) {
> >    return fileName.replace(/[^a-z0-9\-]/gi, ' ').substr(0, 50).trim();
> >  }
> > +
> > +/**
> > + * @param {string} File name.
> > + * @return {string} Extension.
> > + * Returns the extension of a File Name or null if there's none.
> > + */
> > +util.getExtension = function(fileName) {
> > +  var match = /\.([^.\\\/]+)$/.exec(fileName);
> > +
> > +  if (match) {
> > +    return match[1];
> > +  } else {
> > +    return null;
> > +  }
> > +}
>
> LGTM
> … <#143e80ba61d6ce01_>
> -Josh
> On Fri, Jan 31, 2014 at 7:21 PM, François Beaufort <
> notifications@github.com > wrote: In js/util.js: > @@ -60,3 +60,18 @@
> util.writeToWriter_ = function(writer, blob, onsuccess) { >
> util.sanitizeFileName = function(fileName) { > return
> fileName.replace(/[^a-z0-9\-]/gi, ' ').substr(0, 50).trim(); > } > + > +/**
> > + * @param <https://github.com/param> {string} File name. > + * @return<https://github.com/return>{string} Extension. > + * Returns the extension of a File Name or null if
> there's none. > + */ > +util.getExtension = function(fileName) { > + var
> match = /\.([^.\\\/]+)$/.exec(fileName); > + > + if (match) { > + return
> match[1]; > + } else { > + return null; > + } > +} Sorry for that. — Reply
> to this email directly or view it on GitHub<
> https://github.com/GoogleChrome/text-app/pull/205/files#r9338317> .
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/GoogleChrome/text-app/pull/205/files#r9339631>
> .
>