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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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!"
Copy link
Member

Choose a reason for hiding this comment

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

}

if ($RsFolder -eq "/")
Expand Down Expand Up @@ -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

if ($item.Extension -eq ".png")
{
$property.Value = 'image/png'
Expand All @@ -239,6 +240,15 @@ function Write-RsCatalogItem
{
$property.Value = 'image/jpeg'
}
#>
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.

{$_ -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

'.gif' {$property.Value = 'image/gif'}
'.bmp' {$property.Value = 'image/bmp'}
Default {$property.Value = 'image/jpeg'}
}
$errorMessageItemType = 'resource'
}
else
Expand Down