-
Notifications
You must be signed in to change notification settings - Fork 213
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
base: master
Are you sure you want to change the base?
Additional Image Support in Write-RsCatalogItem #215
Conversation
@@ -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' | |||
<# |
There was a problem hiding this comment.
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'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are missing the break; at the end of the switch statement (https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_switch?view=powershell-6)
switch ($item.Extension) | ||
{ | ||
'.png' {$property.Value = 'image/png'} | ||
{$_ -in '.jpg','.jpeg'} {$property.Value = 'image/jpeg'} |
There was a problem hiding this comment.
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!" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please also add a test, check https://github.com/Microsoft/ReportingServicesTools/blob/c92b8b0a06819da698dc10bc21258d79d43aafc1/Tests/CatalogItems/Write-RsCatalogItem.Tests.ps1#L185 for reference
Fixes # 214
Changes proposed in this pull request:
How to test this code:
Has been tested on (remove any that don't apply):