Skip to content

Black square instead of image because of additional path #2

Description

@Ballistx

Thanks for this great tool, it helped me a lot! However, it seems like I found an error, but I'm not very into svgs.

When uploading some android xml svgs they were converted to svgs that were just a black square, except for one image that worked. Removing the last path for all svgs that were a black square helped fix the error.


This one worked:

<vector
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:width="24dp"
  android:height="24dp"
  android:viewportWidth="24"
  android:viewportHeight="24"
  android:tint="?attr/colorControlNormal"
>
  <path
    android:fillColor="@android:color/white"
    android:pathData="M17,16l-4,-4V8.82C14.16,8.4 15,7.3 15,6c0,-1.66 -1.34,-3 -3,-3S9,4.34 9,6c0,1.3 0.84,2.4 2,2.82V12l-4,4H3v5h5v-3.05l4,-4.2 4,4.2V21h5v-5h-4z"
  />
</vector>

It converted into:

<svg
  id="vector"
  xmlns="http://www.w3.org/2000/svg"
  width="24"
  height="24"
  viewBox="0 0 24 24"
>
  <path
    fill="@android:color/white"
    d="M17,16l-4,-4V8.82C14.16,8.4 15,7.3 15,6c0,-1.66 -1.34,-3 -3,-3S9,4.34 9,6c0,1.3 0.84,2.4 2,2.82V12l-4,4H3v5h5v-3.05l4,-4.2 4,4.2V21h5v-5h-4z"
    id="path_0"
  />
</svg>

svgviewer-output (6)


This one did not work:

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24">
  <path
      android:pathData="M12,2a7,7 0,0 0,-7 7c0,2.38 1.19,4.47 3,5.74V17a1,1 0,0 0,1 1h6a1,1 0,0 0,1 -1v-2.26c1.81,-1.27 3,-3.36 3,-5.74a7,7 0,0 0,-7 -7M9,21a1,1 0,0 0,1 1h4a1,1 0,0 0,1 -1v-1H9v1z"
      android:fillColor="#626262"/>
  <path
      android:pathData="M0,0h24v24h-24z"
      android:fillColor="#00000000"/>
</vector>

It converted into:

<svg
  id="vector"
  xmlns="http://www.w3.org/2000/svg"
  width="24"
  height="24"
  viewBox="0 0 24 24"
>
  <path
    fill="#626262"
    d="M12,2a7,7 0,0 0,-7 7c0,2.38 1.19,4.47 3,5.74V17a1,1 0,0 0,1 1h6a1,1 0,0 0,1 -1v-2.26c1.81,-1.27 3,-3.36 3,-5.74a7,7 0,0 0,-7 -7M9,21a1,1 0,0 0,1 1h4a1,1 0,0 0,1 -1v-1H9v1z"
    id="path_0"
  />
  <path fill="#00000000" d="M0,0h24v24h-24z" id="path_1" />
</svg>

svgviewer-output (3)

Removing the last path fixed it:

<svg
  id="vector"
  xmlns="http://www.w3.org/2000/svg"
  width="24"
  height="24"
  viewBox="0 0 24 24"
>
  <path
    fill="#626262"
    d="M12,2a7,7 0,0 0,-7 7c0,2.38 1.19,4.47 3,5.74V17a1,1 0,0 0,1 1h6a1,1 0,0 0,1 -1v-2.26c1.81,-1.27 3,-3.36 3,-5.74a7,7 0,0 0,-7 -7M9,21a1,1 0,0 0,1 1h4a1,1 0,0 0,1 -1v-1H9v1z"
    id="path_0"
  />
</svg>

svgviewer-output (5)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions