Summary
Ran into this when packaging OpenCloud Desktop for Fedora COPR:
For a Space whose quota is unlimited (server reports total == 0), the folder/Space list shows the literal text undefined where the storage usage line should be usage only, or be hidden. The account otherwise connects and syncs normally; only the storage label is wrong.
Steps to reproduce
- Connect the client to an OpenCloud server whose Spaces have no quota limit (capabilities:
"spaces":{"max_quota":0,…}; GET /graph/v1.0/me/drives returns drives whose quota.total is 0/absent).
- Open the account view that lists the Spaces.
Expected behavior
- no storage line (or an "unlimited" indication) for unlimited Spaces.
Actual behavior
- the storage line reads
undefined.
Setup
Root cause
src/gui/folderstatusmodel.cpp, FolderStatusModel::data(), Roles::Quota:
case Roles::Quota: {
qint64 used{};
qint64 total{};
if (auto *space = f->space()) {
const auto quota = space->drive().getQuota();
if (quota.isValid()) {
used = quota.getUsed();
total = quota.getTotal();
}
}
if (total <= 0) {
return {}; // <-- invalid QVariant()
}
return tr("%1 of %2 used").arg(Utility::octetsToString(used), Utility::octetsToString(total));
}
The role is consumed in src/gui/qml/FolderDelegate.qml as a typed string:
required property string quota
...
text: folderDelegate.quota
visible: folderDelegate.quota && !folderDelegate.overallText
When total <= 0, data() returns an invalid QVariant(). Assigned to a required property string, that becomes the JS value undefined, which stringifies to the literal "undefined". The visible: guard then sees a non-empty (truthy) string and shows the label. An empty QString would instead coerce to "", which the guard treats as false and hides as a minimal fix.
The invalid-variant → string coercion is stricter on newer Qt (seen with Qt 6.11); the underlying defect: returning an invalid variant for a role bound to a typed string property is version-independent.
Suggested fix (one line)
if (total <= 0) {
- return {};
+ return QString();
}
This hides the storage line for unlimited Spaces via the existing visible: guard. (A follow-up could instead show "X used" or an "Unlimited" label, but the minimal correctness fix is to stop rendering undefined.)
Summary
Ran into this when packaging OpenCloud Desktop for Fedora COPR:
For a Space whose quota is unlimited (server reports
total == 0), the folder/Space list shows the literal textundefinedwhere the storage usage line should be usage only, or be hidden. The account otherwise connects and syncs normally; only the storage label is wrong.Steps to reproduce
"spaces":{"max_quota":0,…};GET /graph/v1.0/me/drivesreturns drives whosequota.totalis0/absent).Expected behavior
Actual behavior
undefined.Setup
72fe8f), virtual files plugin: offmax_quota: 0Root cause
src/gui/folderstatusmodel.cpp,FolderStatusModel::data(),Roles::Quota:The role is consumed in
src/gui/qml/FolderDelegate.qmlas a typed string:When
total <= 0,data()returns an invalidQVariant(). Assigned to arequired property string, that becomes the JS valueundefined, which stringifies to the literal"undefined". Thevisible:guard then sees a non-empty (truthy) string and shows the label. An emptyQStringwould instead coerce to"", which the guard treats as false and hides as a minimal fix.The invalid-variant →
stringcoercion is stricter on newer Qt (seen with Qt 6.11); the underlying defect: returning an invalid variant for a role bound to a typedstringproperty is version-independent.Suggested fix (one line)
if (total <= 0) { - return {}; + return QString(); }This hides the storage line for unlimited Spaces via the existing
visible:guard. (A follow-up could instead show "X used" or an "Unlimited" label, but the minimal correctness fix is to stop renderingundefined.)