Why does my custom liquid button always display, even without a file?

Hi, I inserted this simple code on a product page but the button is always displayed even when the file isn’t there. Where am I wrong?

{% if product.metafields.custom.scheda_prodotto.file_url != "" %}
<a class="badge price__badge-sale color-accent-2" href="{{ product.metafields.custom.scheda_prodotto | file_url}}" target="_blank">SCHEDA PRODOTTO</a>
{% endif %}

The button is always displayed and when the file is there it works correctly but if the file is not present I get a 404 error

Try these

{% if product.metafields.custom.scheda_prodotto.file_url != blank %}
SCHEDA PRODOTTO
{% endif %}

or

{% if product.metafields.custom.scheda_prodotto.file_url %}
SCHEDA PRODOTTO
{% endif %}

In this way the button is never displayed