Powershell PS1 file uploads appending period to first line of file
Summary
Uploading .ps1 (powershell) scripts via the upload file function appends a '.' to the start of the file.
Able to reproduce in Firefox (68.0.1) and Chrome (75.0.3770)
GitLab WebUI File contents view:
Pasted Code into PowershellISE:
Steps to reproduce
Upload powershell ps1 file to file repository within project in the file repository view the file just uploaded and click edit at the top of the file you will see an extra '.' at the top of the file that was not in the original source file.
What is the current bug behavior?
Copying the source code via the copy to clipboard function copies the invisible '.' however when pasting to a text editor will not show this extra period.
This extra period in the file prevents the code from being run in PowerShellISE even though the period is not visible.
However if you view the raw source this is able to be copied and run just fine (although extra whitespace is notable in the firstline of the file, it doesn't seem to copy the period when copied from the raw view).
What is the expected correct behavior?
Code should not be modified to append this '.' character at the first line on PS1 files.
Results of GitLab environment info
System information System: CentOS 7 Current User: git Using RVM: no Ruby Version: 2.6.3p62 Gem Version: 2.7.9 Bundler Version:1.17.3 Rake Version: 12.3.2 Redis Version: 3.2.12 Git Version: 2.21.0 Sidekiq Version:5.2.7 Go Version: unknown
GitLab information Version: 12.1.1 Revision: f9abaa7d Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 10.7 Using LDAP: yes Using Omniauth: yes Omniauth Providers:
GitLab Shell Version: 9.3.0 Repository storage paths:
- default: /GitBase/repositories GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 17/5 ... yes 17/6 ... yes 16/7 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.5.3 ? ... yes (2.6.3) Git version >= 2.21.0 ? ... yes (2.21.0)