Fix encoding issues when uploading

In Web IDE, when you upload a file, sometimes the encoding isn't
detected correctly. This change fixes fix it.

1. The changeset d1fb29e5
introduced the usage of `FileReader.readAsDataURL` for both binary and
text files. The resulting base64 content is then decoded using `atob`
function, which uses ASCII as its default encoding, whereas for
Unicode content, UTF-8 should be the default.
2. Improvements to the download viewer. Files whose mime type
cannot be detected will have their file name visible before the
download button, and in the name of the downloaded file. Previously,
this defaulted to the base64 uri and the file being named `download`.
184 jobs for !23761 with 26113-webide-upload-encoding in 78 minutes and 32 seconds (queued for 6 seconds)
detached
Status Job ID Name Coverage
  Prepare
passed #423527708
docker gitlab-org
build-qa-image

00:05:22

passed #423527705
gitlab-org
compile-assets pull-cache

00:08:30

passed #423527706
gitlab-org
compile-assets pull-cache foss

00:07:18

passed #423527703
docker gitlab-org
gitlab:assets:compile pull-cache

00:23:57

manual #423527709
gitlab-org allowed to fail manual
manual:review-cleanup
passed #423527711
retrieve-tests-metadata

00:02:21

passed #423527710
gitlab-org
review-stop-failed-deployment

00:01:18

passed #423527707
gitlab-org
setup-test-env

00:08:10

 
  Test
passed #423527725
code_quality

00:16:12

passed #423527913
gitlab-org
danger-review

00:04:47

passed #423527908
gitlab-org
db:check-schema

00:04:23

passed #423527909
gitlab-org
db:migrate-from-v11.11.0

00:13:40

passed #423527906
gitlab-org
db:migrate:reset

00:05:34

passed #423527910
gitlab-org
db:rollback

00:05:06

passed #423527912
gitlab-org
db:rollback geo

00:04:54

passed #423527727
dependency_scanning

00:10:24

passed #423527905
gitlab-org
downtime_check

00:03:37

passed #423527911
gitlab-org
gitlab:setup

00:04:49

passed #423527914
gitlab-org
gitlab_git_test

00:01:03

passed #423527713
gitlab-org
graphql-reference-verify

00:04:24

passed #423527716
gitlab-org
jest

00:35:42

passed #423527717
gitlab-org
jest-foss

00:22:08

passed #423527714
gitlab-org
karma

00:25:23

76.03%
passed #423527715
gitlab-org
karma-foss

00:11:29

passed #423527917
gitlab-org
lint-ci-gitlab

00:01:09

passed #423527720
gitlab-org
memory-on-boot

00:09:13

passed #423527719
gitlab-org
memory-static

00:06:28

passed #423527721
gitlab-org
qa:internal

00:02:38

passed #423527722
gitlab-org
qa:internal-foss

00:02:51

passed #423527723
gitlab-org
qa:selectors

00:04:27

passed #423527724
gitlab-org
qa:selectors-foss

00:02:31

passed #423527902
gitlab-org
rspec fast_spec_helper

00:05:07

passed #423527795
gitlab-org
rspec integration pg9 1/6

00:21:49

passed #423527796
gitlab-org
rspec integration pg9 2/6

00:27:11

passed #423527797
gitlab-org
rspec integration pg9 3/6

00:21:21

passed #423527798
gitlab-org
rspec integration pg9 4/6

00:24:41

passed #423527799
gitlab-org
rspec integration pg9 5/6

00:25:10

passed #423527800
gitlab-org
rspec integration pg9 6/6

00:26:47

passed #423527801
gitlab-org
rspec integration pg9-foss 1/6

00:24:12

passed #423527802
gitlab-org
rspec integration pg9-foss 2/6

00:23:37

passed #423527803
gitlab-org
rspec integration pg9-foss 3/6

00:21:27

passed #423527804
gitlab-org
rspec integration pg9-foss 4/6

00:20:07

passed #423527805
gitlab-org
rspec integration pg9-foss 5/6

00:25:13

passed #423527806
gitlab-org
rspec integration pg9-foss 6/6

00:19:54

passed #423527728
gitlab-org
rspec migration pg9 1/4

00:11:28

passed #423527729
gitlab-org
rspec migration pg9 2/4

00:19:24

passed #423527730
gitlab-org
rspec migration pg9 3/4

00:20:08

passed #423527731
gitlab-org
rspec migration pg9 4/4

00:26:20

passed #423527732
gitlab-org
rspec migration pg9-foss 1/4

00:09:53

passed #423527733
gitlab-org
rspec migration pg9-foss 2/4

00:17:11

passed #423527735
gitlab-org
rspec migration pg9-foss 3/4

00:21:28

passed #423527737
gitlab-org
rspec migration pg9-foss 4/4

00:20:33

passed #423527807
gitlab-org
rspec system pg9 1/24

00:12:27

passed #423527818
gitlab-org
rspec system pg9 10/24

00:16:05

passed #423527819
gitlab-org
rspec system pg9 11/24

00:14:40

passed #423527820
gitlab-org
rspec system pg9 12/24

00:16:57

passed #423527821
gitlab-org
rspec system pg9 13/24

00:16:46

passed #423527822
gitlab-org
rspec system pg9 14/24

00:18:01

passed #423527823
gitlab-org
rspec system pg9 15/24

00:17:42

passed #423527824
gitlab-org
rspec system pg9 16/24

00:15:22

passed #423527825
gitlab-org
rspec system pg9 17/24

00:14:16

passed #423527827
gitlab-org
rspec system pg9 18/24

00:16:48

passed #423527830
gitlab-org
rspec system pg9 19/24

00:20:59

passed #423527808
gitlab-org
rspec system pg9 2/24

00:16:15

passed #423527833
gitlab-org
rspec system pg9 20/24

00:14:35

passed #423527835
gitlab-org
rspec system pg9 21/24

00:16:47

passed #423527838
gitlab-org
rspec system pg9 22/24

00:15:30

passed #423527841
gitlab-org
rspec system pg9 23/24

00:16:41

passed #423527844
gitlab-org
rspec system pg9 24/24

00:17:18

passed #423527809
gitlab-org
rspec system pg9 3/24

00:14:29

passed #423527810
gitlab-org
rspec system pg9 4/24

00:16:57

passed #423527811
gitlab-org
rspec system pg9 5/24

00:19:47

passed #423527812
gitlab-org
rspec system pg9 6/24

00:17:17

passed #423527813
gitlab-org
rspec system pg9 7/24

00:17:31

passed #423527814
gitlab-org
rspec system pg9 8/24

00:16:28

passed #423527817
gitlab-org
rspec system pg9 9/24

00:16:48

passed #423527846
gitlab-org
rspec system pg9-foss 1/24

00:11:24

passed #423527859
gitlab-org
rspec system pg9-foss 10/24

00:14:58

passed #423527860
gitlab-org
rspec system pg9-foss 11/24

00:16:10

passed #423527861
gitlab-org
rspec system pg9-foss 12/24

00:15:43

passed #423527862
gitlab-org
rspec system pg9-foss 13/24

00:16:10

passed #423527863
gitlab-org
rspec system pg9-foss 14/24

00:15:17

passed #423527864
gitlab-org
rspec system pg9-foss 15/24

00:14:45

passed #423527865
gitlab-org
rspec system pg9-foss 16/24

00:15:28

passed #423527866
gitlab-org
rspec system pg9-foss 17/24

00:12:45

passed #423527867
gitlab-org
rspec system pg9-foss 18/24

00:16:00

passed #423527868
gitlab-org
rspec system pg9-foss 19/24

00:17:28

passed #423527849
gitlab-org
rspec system pg9-foss 2/24

00:16:32

passed #423527869
gitlab-org
rspec system pg9-foss 20/24

00:15:25

passed #423527870
gitlab-org
rspec system pg9-foss 21/24

00:16:26

passed #423527871
gitlab-org
rspec system pg9-foss 22/24

00:13:13

passed #423527872
gitlab-org
rspec system pg9-foss 23/24

00:15:19

passed #423527873
gitlab-org
rspec system pg9-foss 24/24

00:16:58

passed #423527851
gitlab-org
rspec system pg9-foss 3/24

00:14:48

passed #423527852
gitlab-org
rspec system pg9-foss 4/24

00:12:47

passed #423527854
gitlab-org
rspec system pg9-foss 5/24

00:15:27

passed #423527855
gitlab-org
rspec system pg9-foss 6/24

00:16:01

passed #423527856
gitlab-org
rspec system pg9-foss 7/24

00:13:44

passed #423527857
gitlab-org
rspec system pg9-foss 8/24

00:16:53

passed #423527858
gitlab-org
rspec system pg9-foss 9/24

00:13:22

passed #423527738
gitlab-org
rspec unit pg9 1/20

00:19:29

passed #423527747
gitlab-org
rspec unit pg9 10/20

00:19:51

passed #423527748
gitlab-org
rspec unit pg9 11/20

00:18:48

passed #423527749
gitlab-org
rspec unit pg9 12/20

00:17:47

passed #423527750
gitlab-org
rspec unit pg9 13/20

00:23:40

passed #423527751
gitlab-org
rspec unit pg9 14/20

00:19:56

passed #423527752
gitlab-org
rspec unit pg9 15/20

00:18:36

passed #423527754
gitlab-org
rspec unit pg9 16/20

00:17:56

passed #423527755
gitlab-org
rspec unit pg9 17/20

00:19:10

passed #423527756
gitlab-org
rspec unit pg9 18/20

00:19:55

passed #423527757
gitlab-org
rspec unit pg9 19/20

00:19:16

passed #423527739
gitlab-org
rspec unit pg9 2/20

00:18:25

passed #423527758
gitlab-org
rspec unit pg9 20/20

00:21:45

passed #423527740
gitlab-org
rspec unit pg9 3/20

00:16:20

passed #423527741
gitlab-org
rspec unit pg9 4/20

00:16:47

passed #423527742
gitlab-org
rspec unit pg9 5/20

00:19:57

passed #423527743
gitlab-org
rspec unit pg9 6/20

00:18:48

passed #423527744
gitlab-org
rspec unit pg9 7/20

00:19:42

passed #423527745
gitlab-org
rspec unit pg9 8/20

00:20:55

passed #423527746
gitlab-org
rspec unit pg9 9/20

00:17:52

passed #423527760
gitlab-org
rspec unit pg9-foss 1/20

00:23:31

passed #423527782
gitlab-org
rspec unit pg9-foss 10/20

00:18:27

passed #423527783
gitlab-org
rspec unit pg9-foss 11/20

00:15:14

passed #423527784
gitlab-org
rspec unit pg9-foss 12/20

00:16:08

passed #423527785
gitlab-org
rspec unit pg9-foss 13/20

00:18:34

passed #423527786
gitlab-org
rspec unit pg9-foss 14/20

00:15:30

passed #423527787
gitlab-org
rspec unit pg9-foss 15/20

00:18:48

passed #423527789
gitlab-org
rspec unit pg9-foss 16/20

00:17:24

passed #423527790
gitlab-org
rspec unit pg9-foss 17/20

00:15:18

passed #423527792
gitlab-org
rspec unit pg9-foss 18/20

00:18:55

passed #423527793
gitlab-org
rspec unit pg9-foss 19/20

00:18:01

passed #423527763
gitlab-org
rspec unit pg9-foss 2/20

00:18:42

passed #423527794
gitlab-org
rspec unit pg9-foss 20/20

00:17:08

passed #423527768
gitlab-org
rspec unit pg9-foss 3/20

00:14:51

passed #423527771
gitlab-org
rspec unit pg9-foss 4/20

00:16:57

passed #423527774
gitlab-org
rspec unit pg9-foss 5/20

00:15:07

passed #423527777
gitlab-org
rspec unit pg9-foss 6/20

00:16:31

passed #423527779
gitlab-org
rspec unit pg9-foss 7/20

00:16:15

passed #423527780
gitlab-org
rspec unit pg9-foss 8/20

00:14:49

passed #423527781
gitlab-org
rspec unit pg9-foss 9/20

00:16:32

passed #423527900
gitlab-org
rspec-ee integration pg10 geo

00:10:17

passed #423527884
gitlab-org
rspec-ee integration pg9 1/3

00:31:30

passed #423527885
gitlab-org
rspec-ee integration pg9 2/3

00:17:45

passed #423527886
gitlab-org
rspec-ee integration pg9 3/3

00:21:42

passed #423527896
gitlab-org
rspec-ee integration pg9 geo

00:08:07

passed #423527876
gitlab-org
rspec-ee migration pg9 1/2

00:07:41

passed #423527878
gitlab-org
rspec-ee migration pg9 2/2

00:08:02

passed #423527901
gitlab-org
rspec-ee system pg10 geo

00:09:47

passed #423527887
gitlab-org
rspec-ee system pg9 1/5

00:20:05

passed #423527888
gitlab-org
rspec-ee system pg9 2/5

00:21:38

passed #423527889
gitlab-org
rspec-ee system pg9 3/5

00:19:51

passed #423527890
gitlab-org
rspec-ee system pg9 4/5

00:22:28

passed #423527891
gitlab-org
rspec-ee system pg9 5/5

00:19:25

passed #423527897
gitlab-org
rspec-ee system pg9 geo

00:08:26

passed #423527898
gitlab-org
rspec-ee unit pg10 geo 1/2

00:14:40

passed #423527899
gitlab-org
rspec-ee unit pg10 geo 2/2

00:23:02

passed #423527879
gitlab-org
rspec-ee unit pg9 1/5

00:25:22

passed #423527880
gitlab-org
rspec-ee unit pg9 2/5

00:28:52

passed #423527881
gitlab-org
rspec-ee unit pg9 3/5

00:30:05

passed #423527882
gitlab-org
rspec-ee unit pg9 4/5

00:28:09

passed #423527883
gitlab-org
rspec-ee unit pg9 5/5

00:27:08

passed #423527893
gitlab-org
rspec-ee unit pg9 geo 1/2

00:15:32

passed #423527894
gitlab-org
rspec-ee unit pg9 geo 2/2

00:20:22

passed #423527916
gitlab-org
run-dev-fixtures-ee

00:04:38

passed #423527915
gitlab-org
run-dev-fixtures-foss

00:04:28

passed #423527726
sast

00:13:16

passed #423527903
gitlab-org
static-analysis 1/2

00:17:29

passed #423527904
gitlab-org
static-analysis 2/2

00:10:39

passed #423527718
gitlab-org
webpack-dev-server

00:06:09

 
  Post Test
passed #423527918
gitlab-org
coverage

00:10:36

97.57%
failed #423527919
gitlab-org allowed to fail
flaky-examples-check

00:04:45

 
  Review Prepare
passed #423527920
gitlab-org
review-build-cng

00:27:11

 
  Review
passed #423527921
gitlab-org
review-deploy

00:06:52

passed #423527922
gitlab-org manual
review-stop

00:01:25

 
  Qa
passed #423527924
dast

00:15:20

manual #423527923
allowed to fail manual
package-and-qa
passed #423527931
docker gitlab-org
review-performance

00:04:04

manual #423527926
docker gitlab-org allowed to fail manual
review-qa-all 1/5
manual #423527927
docker gitlab-org allowed to fail manual
review-qa-all 2/5
manual #423527928
docker gitlab-org allowed to fail manual
review-qa-all 3/5
manual #423527929
docker gitlab-org allowed to fail manual
review-qa-all 4/5
manual #423527930
docker gitlab-org allowed to fail manual
review-qa-all 5/5
failed #423527925
docker gitlab-org allowed to fail
review-qa-smoke

00:01:48

 
  Post Qa
manual #423527932
gitlab-org allowed to fail manual
parallel-spec-reports
 
Name Stage Failure
failed
review-qa-smoke Qa
Gem files will remain installed in /usr/local/bundle/gems/nokogiri-1.10.7 for inspection.
Results logged to /usr/local/bundle/extensions/x86_64-linux/2.6.0/nokogiri-1.10.7/gem_make.out
Running after script...
$ date
Mon Feb 3 08:47:25 UTC 2020
Uploading artifacts...
WARNING: ./qa/gitlab-qa-run-*: no matching files
ERROR: No files to upload
ERROR: Job failed: exit code 1
failed
flaky-examples-check Post Test
    "first_flaky_at": "2020-02-03 08:16:33 +0000",
"last_flaky_at": "2020-02-03 08:16:33 +0000",
"last_flaky_job": "https://gitlab.com/gitlab-org/gitlab/-/jobs/423527799"
}
}
Running after script...
$ date
Mon Feb 3 08:32:50 UTC 2020
ERROR: Job failed: exit code 1