Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional Image Support in Write-RsCatalogItem #215

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Branden-DeVries
Copy link

Fixes # 214

Changes proposed in this pull request:

  • Adds support for .gif and .bmp image files and sets the MimeType

How to test this code:

Has been tested on (remove any that don't apply):

  • Powershell 5.1 and above
  • Windows Server 2016 and above
  • SQL Server Reporting Services 2017 and above

@@ -231,6 +231,7 @@ function Write-RsCatalogItem
#If it is a resource we need to save the extension so the file can be recognized
$itemName = $item.Name
$property.Name = 'MimeType'
<#
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to delete code rather than comment it out if you're replacing it

#>
switch ($item.Extension)
{
'.png' {$property.Value = 'image/png'}
Copy link
Member

@jtarquino jtarquino Jan 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switch ($item.Extension)
{
'.png' {$property.Value = 'image/png'}
{$_ -in '.jpg','.jpeg'} {$property.Value = 'image/jpeg'}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for better readbility please split the condition for .jpg and jpeg

)
)
{
throw "Invalid item specified! You can only upload Report, DataSource, DataSet and jpg/png files using this command!"
throw "Invalid item specified! You can only upload Report, DataSource, DataSet and jpg/png/gif/bmp files using this command!"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants