Discovered by changing the capitalisation for a network name within the web interface and resulted in Network [network] already exists message.
Discovered by changing the capitalisation for a network name within the web interface and resulted in `Network [network] already exists` message.
<!-- github-sync-id:267453738 -->
What if we make the binary comparison in NetworkPage() case-insensitive and set the network name to pick up capitalization modifications? It doesn't need to add a new network there since only the capitalization changed, it's still the same network name from a case-insensitive point-of-view.
The error message is located in [`AddNetwork()`](https://github.com/znc/znc/blob/6cd80535c064e91155468e79f50fc1c3f3c0f3e5/src/User.cpp#L511) where a case-insensitive search returns a "conflicting" network name with the original casing.
Looks like the call to `AddNetwork()` begins with [a binary comparison in `NetworkPage()`](https://github.com/znc/znc/blob/6cd80535c064e91155468e79f50fc1c3f3c0f3e5/modules/webadmin.cpp#L1080).
What if we make the binary comparison in `NetworkPage()` case-insensitive and set the network name to pick up capitalization modifications? It doesn't need to add a new network there since only the capitalization changed, it's still the same network name from a case-insensitive point-of-view.
```c++
if (!pNetwork || !pNetwork->GetName().Equals(sName)) {
...
} else {
pNetwork->SetName(sName);
}
```
<!-- github-comment-id:711325838 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Discovered by changing the capitalisation for a network name within the web interface and resulted in
Network [network] already existsmessage.The error message is located in
AddNetwork()where a case-insensitive search returns a "conflicting" network name with the original casing.Looks like the call to
AddNetwork()begins with a binary comparison inNetworkPage().What if we make the binary comparison in
NetworkPage()case-insensitive and set the network name to pick up capitalization modifications? It doesn't need to add a new network there since only the capitalization changed, it's still the same network name from a case-insensitive point-of-view.That probably works. Webadmin is not the only way to edit networks though. Also you'll need a test.
Okay, I got webadmin and
/znc movenetwork. Are there other methods for renaming a network?That's it