Skip to content

Commit

Permalink
Fixed SGF uploading issue
Browse files Browse the repository at this point in the history
Not all platforms have mime types setup for sgfs (duh), so now we just
filter based on filename instead of mime type.

Fixes #39
  • Loading branch information
anoek committed Feb 27, 2017
1 parent 502aba8 commit e6da3a6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/views/LibraryPlayer/LibraryPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ export class LibraryPlayer extends React.PureComponent<LibraryPlayerProperties,
}

uploadSGFs = (files) => {{{
if (this.props.params.player_id === data.get("user").id) {
if (parseInt(this.props.params.player_id) === data.get("user").id) {
files = files.filter((file) => /.sgf$/i.test(file.name));
Promise.all(files.map((file) => post(`me/games/sgf/${this.state.collection_id}`, file)))
.then(() => {
this.refresh(this.props.params.player_id);
Expand Down Expand Up @@ -330,7 +331,7 @@ export class LibraryPlayer extends React.PureComponent<LibraryPlayerProperties,



<Dropzone ref="dropzone" className="Dropzone" onDrop={this.uploadSGFs} multiple={true} disableClick accept="application/x-go-sgf">
<Dropzone ref="dropzone" className="Dropzone" onDrop={this.uploadSGFs} multiple={true} disableClick>
<Card>

{owner &&
Expand Down

0 comments on commit e6da3a6

Please sign in to comment.