microsoft / Analysis-Services

Git repo for Analysis Services samples and community projects
MIT License
605 stars 416 forks source link

[FabricPS-PBIP] Export-FabricItems: PNG image files in ReportName.Report\StaticResources\RegisteredResources are corrupted #266

Closed JamesDBartlett3 closed 4 months ago

JamesDBartlett3 commented 5 months ago

When a report is saved in PBIP format, all images embedded in that report are saved as PNG files in the ReportName.Report\StaticResources\RegisteredResources folder (adjacent to the .PBIP file).

When the report is saved locally by Power BI Desktop, these PNG files are valid image files, and they can be opened by any image viewer app. But when the report is exported from the Power BI service by Export-FabricItems, those same PNG files are corrupted, so they cannot be opened in any image viewer app.

image image

As a result, if the user opens a ReportName.Report\definition.pbir file that was exported with Export-FabricItems in Power BI Desktop, none of the embedded images will display properly, and if the user publishes that report from Power BI Desktop to the Power BI service, the embedded images will not display properly there either.

image image

The PNG files that were saved locally with Power BI Desktop are actually smaller than the ones that were exported with Export-FabricItems, so I think it's pretty likely that some extra bytes of data are being added to the files during the export process, and that is causing them to become corrupted. image

@RuiRomano, please let me know if I may be of any assistance with sorting this out.

RuiRomano commented 5 months ago

Thanks James, I'm looking into this. Not sure if its caused by the Fabric Get Definition API or my code.

JamesDBartlett3 commented 4 months ago

@RuiRomano, is there any way I can be of assistance in sorting this out?

RuiRomano commented 4 months ago

Sorry for the late reply. It was a bug in the Fabric API that was fixed last week. The fix is expected to hit production tenants by the end of the month. Thanks again for reporting.

JamesDBartlett3 commented 4 months ago

Thank you, @RuiRomano!

JamesDBartlett3 commented 4 months ago

For anyone who might be curious about this bug in the future, here's a peek at the inside of two PNG files. The first file was taken directly from a local PBIP report file, and the second file was taken from a copy of that same report, which had been published in the Power BI service and then exported as PBIP using the Fabric REST APIs.

Vector33222948871756963.png
0000000000000000   89 50 4E 47 0D 0A 1A 0A 00 00 00 0D 49 48 44 52  �PNG����   �IHDR
0000000000000010   00 00 00 0F 00 00 00 14 08 06 00 00 00 52 C7 67     �   ���   RÇg
0000000000000020   12 00 00 00 04 67 41 4D 41 00 00 B1 8F 0B FC 61  �   �gAMA  ±��üa
0000000000000030   05 00 00 00 09 70 48 59 73 00 00 0B 12 00 00 0B  �   �pHYs  ��  �
0000000000000040   12 01 D2 DD 7E FC 00 00 01 1D 49 44 41 54 38 4F  ��ÒÝ~ü  ��IDAT8O
0000000000000050   8D 94 61 B1 C2 30 10 84 23 01 09 CC B4 FD 8F 04  ��a±Â0��#��Ì´ý��
0000000000000060   1C 80 03 70 00 12 70 00 0E C0 01 12 2A A1 12 90  ���p �p �À��*¡��
0000000000000070   80 84 B2 5F 66 DB F7 C2 1C 84 9D D9 C9 E4 6E F7  ��²_fÛ÷Â���ÙÉän÷
0000000000000080   EE 92 06 D2 3B DA B6 5D 37 4D 73 D5 FA 14 47 AF  î��Ò;Ú¶]7MsÕú�G¯
0000000000000090   BD 62 3B 4B 62 48 74 B6 01 F1 5E 2B 85 B6 E2 4D  ½b;KbHt¶�ñ^+�¶âM
00000000000000A0   7C C0 A5 60 F9 1F 30 92 C4 E0 50 01 4C CA 0D 2E  |À¥`ù�0�ÄàP�LÊ�.
00000000000000B0   B0 70 38 25 05 E8 32 86 55 FF 01 93 1B 9C 1D CA  °p8%�è2�Uÿ�����Ê
00000000000000C0   5D A9 78 F5 F6 2B 98 CC 8D 16 D3 38 63 D7 75 2B  ]©xõö+�Ì��Ó8c×u+
00000000000000D0   E7 AB 90 FE C9 B4 73 25 C7 7F 82 F4 BD 78 4A 74  ç«�þÉ´s%Ç��ô½xJt
00000000000000E0   C4 9C C7 F8 11 B3 19 13 66 31 BC E5 08 D2 32 F6  Ä�Çø�³��f1¼å�Ò2ö
00000000000000F0   66 DA 50 A9 CF 9B 0A 34 E9 81 1B F7 36 07 F2 E8  fÚP©Ï��4é��÷6�òè
0000000000000100   E2 D1 A1 10 D6 D1 B5 7C 6D 18 29 A0 C4 D6 A1 02  âÑ¡�Öѵ|m�) ÄÖ¡�
0000000000000110   7C 15 3A 8A 17 87 4A 90 A0 72 74 79 CA DD 94 FB  |�:���J� rtyÊÝ�û
0000000000000120   7C 34 5F 1E 3F 84 62 7C BA 32 15 AB 43 31 E8 20  |4_�?�b|º2�«C1è 
0000000000000130   16 AF 8D 62 E2 E0 ED 67 48 74 A2 4B C0 FA D7 90  �¯�bâàígHt¢KÀú×�
0000000000000140   08 F3 20 F2 F2 32 AB E7 9D 20 11 E6 42 18 C5 42  �ó òò2«ç� �æB�ÅB
0000000000000150   48 C4 F9 B8 B4 B9 B3 78 17 EB 66 DF 38 63 CF E7  HÄù¸´¹³x�ëfß8cÏç
0000000000000160   D5 D8 C1 3F 48 4A 2F 60 50 74 42 39 FD BA 95 00  ÕØÁ?HJ/`PtB9ýº� 
0000000000000170   00 00 00 49 45 4E 44 AE 42 60 82                    IEND®B`�     

Vector33222948871756963_error.png
0000000000000000   EF BF BD 50 4E 47 0D 0A 1A 0A 00 00 00 0D 49 48  �PNG����   �IH
0000000000000010   44 52 00 00 00 0F 00 00 00 14 08 06 00 00 00 52  DR   �   ���   R
0000000000000020   EF BF BD 67 12 00 00 00 04 67 41 4D 41 00 00 EF  �g�   �gAMA  ï
0000000000000030   BF BD EF BF BD 0B EF BF BD 61 05 00 00 00 09 70  ¿½ï¿½��a�   �p
0000000000000040   48 59 73 00 00 0B 12 00 00 0B 12 01 EF BF BD EF  HYs  ��  ����ï
0000000000000050   BF BD 7E EF BF BD 00 00 01 1D 49 44 41 54 38 4F  ¿½~�  ��IDAT8O
0000000000000060   EF BF BD EF BF BD 61 EF BF BD EF BF BD 30 10 EF  ��a��0�ï
0000000000000070   BF BD 23 01 09 CC B4 EF BF BD EF BF BD 04 1C EF  ¿½#��̴����ï
0000000000000080   BF BD 03 70 00 12 70 00 0E EF BF BD 01 12 2A EF  ¿½�p �p ����*ï
0000000000000090   BF BD 12 EF BF BD EF BF BD EF BF BD EF BF BD 5F  ¿½�����_
00000000000000A0   66 EF BF BD EF BF BD EF BF BD 1C EF BF BD EF BF  f�����ï¿
00000000000000B0   BD EF BF BD EF BF BD EF BF BD 6E EF BF BD EF BF  ½ï¿½ï¿½ï¿½n�ï¿
00000000000000C0   BD 06 EF BF BD 3B DA B6 5D 37 4D 73 EF BF BD EF  ½��;Ú¶]7Ms�ï
00000000000000D0   BF BD 14 47 EF BF BD EF BF BD 62 3B 4B 62 48 74  ¿½�G��b;KbHt
00000000000000E0   EF BF BD 01 EF BF BD 5E 2B EF BF BD EF BF BD EF  ���^+��ï
00000000000000F0   BF BD 4D 7C EF BF BD EF BF BD 60 EF BF BD 1F 30  ¿½M|��`��0
0000000000000100   EF BF BD EF BF BD EF BF BD 50 01 4C EF BF BD 0D  ���P�L��
0000000000000110   2E EF BF BD 70 38 25 05 EF BF BD 32 EF BF BD 55  .�p8%��2�U
0000000000000120   EF BF BD 01 EF BF BD 1B EF BF BD 1D EF BF BD 5D  �������]
0000000000000130   EF BF BD 78 EF BF BD EF BF BD 2B EF BF BD CC 8D  �x��+��
0000000000000140   16 EF BF BD 38 63 EF BF BD 75 2B E7 AB 90 EF BF  ��8c�u+ç«�ï¿
0000000000000150   BD C9 B4 73 25 EF BF BD 7F EF BF BD EF BF BD 78  ½É´s%����x
0000000000000160   4A 74 C4 9C EF BF BD EF BF BD 11 EF BF BD 19 13  Jt�������
0000000000000170   66 31 EF BF BD EF BF BD 08 EF BF BD 32 EF BF BD  f1����2�
0000000000000180   66 EF BF BD 50 EF BF BD CF 9B 0A 34 EF BF BD 1B  f�P���4��
0000000000000190   EF BF BD 36 07 EF BF BD EF BF BD EF BF BD D1 A1  �6����ѡ
00000000000001A0   10 EF BF BD D1 B5 7C 6D 18 29 EF BF BD EF BF BD  ��ѵ|m�)��
00000000000001B0   D6 A1 02 7C 15 3A EF BF BD 17 EF BF BD 4A EF BF  Ö¡�|�:���Jï¿
00000000000001C0   BD EF BF BD 72 74 79 EF BF BD DD 94 EF BF BD 7C  ½ï¿½rty�Ý��|
00000000000001D0   34 5F 1E 3F EF BF BD 62 7C EF BF BD 32 15 EF BF  4_�?�b|�2�ï¿
00000000000001E0   BD 43 31 EF BF BD 20 16 EF BF BD EF BF BD 62 EF  ½C1� ���bï
00000000000001F0   BF BD EF BF BD EF BF BD 67 48 74 EF BF BD 4B EF  ¿½ï¿½ï¿½gHt�Kï
0000000000000200   BF BD EF BF BD D7 90 08 EF BF BD 20 EF BF BD EF  ¿½ï¿½×��� �ï
0000000000000210   BF BD 32 EF BF BD EF BF BD 20 11 EF BF BD 42 18  ¿½2�� ��B�
0000000000000220   EF BF BD 42 48 EF BF BD EF BF BD EF BF BD EF BF  �BH���ï¿
0000000000000230   BD EF BF BD EF BF BD 78 17 EF BF BD 66 EF BF BD  ½ï¿½ï¿½x��f�
0000000000000240   38 63 EF BF BD EF BF BD EF BF BD EF BF BD EF BF  8c����ï¿
0000000000000250   BD 3F 48 4A 2F 60 50 74 42 39 EF BF BD EF BF BD  ½?HJ/`PtB9��
0000000000000260   EF BF BD 00 00 00 00 49 45 4E 44 EF BF BD 42 60  �    IEND�B`
0000000000000270   EF BF BD                                         �             

As we can see by comparing the contents of these two PNG files, both the file header and the entire contents of the file were corrupted during the export process, rendering the file completely unusable and unrecoverable. I've also attached a zip file containing both files and a PowerShell script that you can run to compare their hexadecimal contents for yourself. Inspect-PNGFilesContentsAsHex.zip