-
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,11 +122,11 @@ function Write-RsCatalogItem | |
) -or | ||
( | ||
$itemType -eq "Resource" -and | ||
$item.Extension -notin ('.png', '.jpg', '.jpeg') | ||
$item.Extension -notin ('.png', '.jpg', '.jpeg','.gif','.bmp') | ||
) | ||
) | ||
{ | ||
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!" | ||
} | ||
|
||
if ($RsFolder -eq "/") | ||
|
@@ -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 commentThe 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 |
||
if ($item.Extension -eq ".png") | ||
{ | ||
$property.Value = 'image/png' | ||
|
@@ -239,6 +240,15 @@ function Write-RsCatalogItem | |
{ | ||
$property.Value = 'image/jpeg' | ||
} | ||
#> | ||
switch ($item.Extension) | ||
{ | ||
'.png' {$property.Value = 'image/png'} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) |
||
{$_ -in '.jpg','.jpeg'} {$property.Value = 'image/jpeg'} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for better readbility please split the condition for .jpg and jpeg |
||
'.gif' {$property.Value = 'image/gif'} | ||
'.bmp' {$property.Value = 'image/bmp'} | ||
Default {$property.Value = 'image/jpeg'} | ||
} | ||
$errorMessageItemType = 'resource' | ||
} | ||
else | ||
|
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